π Backend for language learners π to easily write down, store, and memorize vocabulary and phrases π with advanced review techniques π₯
cp .env.example .env.development
cp .env.example .env.productionEdit env-files for your purposes.
docker compose --env-file .env.development -f docker-compose.yml -f docker-compose.dev.yml up --builddocker compose --env-file .env.production up --build -ddocker compose downpsql -h localhost -p 5432 -U dictionary -d dictionaryUsing the predefined npm scripts:
npm run migrate:dev -- --name migration_nameInside the docker container:
docker compose exec dictionary-backend npx prisma migrate dev --name migration_nameOutside the docker container (make sure you have set the DATABASE_URL variable in your environment):
DATABASE_URL=postgresql://user:password@localhost:5432/dictionary npx prisma migrate dev --name migration_nameor (prisma/.env file with the DATABASE_URL variable must exist):
npx prisma migrate dev --name migration_nameWarning! Seeding creates an admin user. You must set a strong
ADMIN_PASSWORDin.envfile you use for production before seeding and change it through API as soon as possible.
docker compose exec dictionary-backend npx prisma db seedWith specific .env file:
docker compose --env-file .env.development exec dictionary-backend npx prisma db seedDATABASE_URL=postgresql://user:password@localhost:5432/dictionary npx prisma db seedor just (if the DATABASE_URL environment variable is set properly):
npx prisma db seedIn this mode the database container is not accessible from outside, so we need to connect to the backend container first to access the database service from it:
docker exec -it dictionary-backend /bin/sh
apk update
apk add postgresql-client
psql -h postgres -U dictionary -d dictionary # hostname (-h) can be either the service name or the container name from the docker compose config