Trassenscout (Beta) aids administrations in evaluating and developing cycle highways and other similar route-based infrastructure.
Please contact hello@fixmycity.de to learn more.
This project is build with Blitz a toolkit build upon React. Data is stored in a PostgreSQL database using Docker.
For starting developing, the following steps could be helpful for getting started:
- Use or nvm to install Node.js:
nvm use - Install dependencies:
npm install - Start develop environment:
npm run dev(start docker, start blitz) - Run all checks:
npm run check(check migrations, check typescript run linter, run prettier, run tests) - Use
npm run build && npx serve distto test the build - Husky: We run our checks on push. Use
git push --no-verifyto force-skip them.
There is a .env.local and a .env.production file, which provide the keys to some services.
Blitz vs. NextJS
- Blitz provides the basic file structure and conventions (Docs)
- BLitz provides the Blitz CLI (Docs), especially the generators (Docs)
- Blitz handles Authentication with Blitz Auth (Docs)
- Blitz handles the communication between server and client with Blitz RPC (Docs)
- Blitz enhances Next with type save routes (Docs)
- Everything else is part of Next and documented in the Next Docs.
-
Setup
.env.local:
This will setup up the Environment Variables for PostgreSQL.cp .env.local.example .env.local -
Install Docker and open it once to finish the setup:
brew install --cask docker -
Start the PostgreSQL Server
This is done automatically withnpm run dev.docker compose up -d -
Seed your database:
Which will also apply migrations.npm run seed -
Run your app in the development mode:
npm run dev -
Open http://localhost:3000.
Runs your tests using Jest.
npm run test
Blitz comes with a test setup using Vitest and react-testing-library.
Follow this steps to add a model with forms and pages:
-
Use
blitz g all calendarEntries title:string startAt:dateTime "locationName:string?" "locationUrl:string?" "description:string?" --dry-runfor scaffolding.- Run
--dry-runfirst to check the folder names and file names.
- Run
-
Check db/schema.prisma if all was "translated".
-
Use
npm run migrate:create(blitz prisma migrate dev --create-only) to create the migration but not run it direclty. -
Double check the migration. For example, column renames are handled by deleting the column and adding a new one which we do not always want.
-
Use
npm run migrate(blitz prisma migrate dev) to apply the migration. -
Schema:
- Follow the steps in
src/core/templates/page/__modelIdParam__/edit.tsxto create a shared Zod schema (Docs) and add it to the form for client side validations. - Update the Zod schema to match the Prisma schema.
- You can use
type UserType = z.infer<typeof UserSchema>to create a TS schema from Zod that can be compared to the prisma schema (which are located innode_modules/.prisma/client/index.d.ts) - You can use https://github.com/CarterGrimmeisen/zod-prisma to generate a starting point for this based on the prisma schema. However, this package should only be used in a separate branch since it collides with blitz in some way.
- You can use
- Follow the steps in
-
Add seed data in db/seeds.ts – all models should have good seed data.