Node 17+
The project is mounted with Docker and thus, to install it you should just use basic docker-compose commands.
docker-compose build
docker-compose up -d
docker-compose exec --workdir=/app nextjs npx prisma migrate dev
. prisma/games.db file should appear.docker-compose exec --workdir=/app nextjs yarn test_docker
docker-compose exec nextjs bash
to have a shell inside the container.http://localhost:3000
in your browser (Requires the container running)After you've installed a frontend package i.e. by adding it to package.json
or with yarn add <packagename>
,
it should be automatically updated inside your running Docker container. In case it doesn't you can run make sure it's updated in docker by running docker-compose exec --workdir=/app frontend yarn install
manually, or just rebuild the container
Backend uses Prisma to set up a database.
For manual run,
npx prisma migrate dev
or in Docker
docker-compose exec --workdir=/app nextjs npx prisma migrate dev
ORM is Prisma.
To add a migration, you could change your data schema in prisma/schema.prisma and run npx prisma migrate dev
again (or its Docker counterpart docker-compose exec --workdir=/app nextjs npx prisma migrate dev
)
i.e. prisma/schema.prisma
:
Before:
model Game {
id String @id @default(uuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
field String
}
After:
model Game {
id String @id @default(uuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
field String
myNewColumn String
}
Running docker-compose exec --workdir=/app nextjs npx prisma migrate dev
will add a new migration and migrate the db schema.
!! Don't forget to commit it into the repo so we can run your app !!