starter challenge
The challenge
Your challenge is to create a good old todo app. Boring, i know, but still a good exercise:
- A logged in user should be able to create new Todo-lists
- A list should have some title and of course Todos
- A todo has some title and whether it's done
- users can have multiple todolists
- everything should be persisted in the database
- use apollo queries and mutations to fetch and update data
- other users or not logged in users should not see other's todolists
Feel free to spice things up, make it beautiful, fancy, add more functionality, etc.
Setup
This is a nextjs project with
- next-auth for autorization (currently uses google login)
- apollo server
- nexus to define graphql resolvers and schema
- prisma for database (using progress)
- nexus-plugin-prisma to derive graphql types from the prisma schema
- styled-components for styling
getting started
run yarn dev
to run it locally on localhost:3000
Env vars
You need to define some env vars, see .env.template.
You additionaly need to create oauth credentials to signin with google (https://console.cloud.google.com/apis/dashboard) You can also replace
db schema changes
edit schema.prisma to adjust the schema. Make sure to use the Prisma vscode extension for formatting, syntax highlighting and automatically set references correctly.
Then, run yarn prisma migrate dev
to create a migration and push your changes to the DB
Adjust graphql api
Add new types in src/graphql/types and import them into the schema.
If the name of a type matches a prisma Model, you can use t.model.xxx()
to forward the fields. If you just
adjusted the prisma schema, you sometimes have to restart the server