- Install Docker
- Install VSCode
- Install Remote - Containers extension
- Open the project in VSCode.
- Copy the
.env.example
to.env
. - Click on the button in the bottom left corner and select "Reopen in Container".
The devcontainer consists of the following services:
- Development Container itself
- PostgreSQL Database
- Directus CMS
Before getting started, install the global dependencies:
bun install
Once the devcontainer is running, you can access the Directus CMS at http://localhost:8055.
On the first install, you will have to wait for Directus to finish setting up the database. Make sure you are able to access the login page before continuing.
To load the schema, run the following command in the terminal:
bun directus-apply
Login with the default credentials admin@example.com
and d1r3ctu5
.
To fix the "You don't have permission to access this." error, you can create a random collection and delete it afterwards.
-
In Directus, create a new directus token under Users -> Admin User -> Token.
-
Copy the token and add it to the
.env
file asDIRECTUS_TOKEN
. -
Generate types for the schema (you might have to reload the window after):
bun run prisma generate
-
To start the frontend, run the following command in the terminal:
bun dev --turbo
The frontend is now accessible at http://localhost:3000.
-
Create a snapshot of the new schema:
bun directus-snapshot
-
Generate types for the new schema (you might have to reload the window after):
bun gen-types
This will:
- Introspect the database and generate the file
backend/schema.prisma
. - Fix the naming of the Prisma schema using
prisma-case-format
. - Generate types for the Prisma client. The generated types are saved in
node_modules/.prisma/client/index.d.ts
.
- Introspect the database and generate the file