This is a learning repo to build a simple REST/GraphQL API with data from SQLite database.
- Fastify server
- SQLite database with Drizzle ORM BetterSqlite3 adapter
- GraphQL Yoga server served as a fastify endpoint
- Database is initialised with a base schema and seeded with data using faker
- Explore the scripts in package.json
npm run dev
starts the server. Explore the available REST and GraphQL endpoints.- Explore drizzle.config.ts to learn how database schema is setup. If you change the schema, remember to run
npm run generate:migration
to generate the migration files and thennpm run migrate
to apply the migrations to the database. - Explore the seeding script to learn how the database is seeded. This is already run but if you delete the database file, you should run it again.
- /rest/users is an example endpoint
- /graphql is the graphql endpoint with an example schema
Go crazy. 🚀