A Node.js app to manage cooking recipes.
- backend: Directus app interacting with the database and providing the GraphQL API
- frontend: Vue 3 app fetching and displaying data from the GraphQL API
This app rely on some third-party services:
- Algolia: to search recipes
Dependencies: Docker
- Copy
packages/backend/.env.example
topackages/backend/.env
and fill-in the values - Copy
packages/frontend/.env.local.example
topackages/frontend/.env.local
and fill-in the values - Run
docker compose up
and wait for the containers to build and start - Load the schema in the database
docker compose exec backend npx directus schema apply schema.yml
- Visit localhost:8055/admin for Directus admin
- Visit localhost:3000 for the app
For example if you want to add a new dependency to the backend
app:
docker compose exec backend npm install my-new-package
Where backend
is the target container, see docker-compose.yml
for all container names.
By default, in development, the backend is configured to send emails to Mailhog. You can browse outgoing emails at localhost:8025.
GraphQL types for TypeScript are automatically generated. To update them to match the Directus schema:
# 1) In the project root, ensure you have Node dependencies installed
npm install
# 2) Ensure Directus "Public" role has full CRUD permissions on all collections in http://localhost:8055/admin/settings/roles/public
# 3) Generate the types based on /graphql.config.js settings
npm run gen:graphql:types
To reindex all the recipes in Algolia, you can do so using the Directus CLI:
docker compose exec backend npx directus extension:searchsync index
You need to drop your local database first:
docker compose exec db dropdb -U cookr cookr
Password is cookr
.
You can now pull the database using the Heroku CLI:
PGUSER=cookr PGHOST=127.0.0.1 heroku pg:pull {heroku-postgres-db-id} cookr --app {heroku-app-id}
Same password.