Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tomdoestech/fastify-prisma-rest-api
https://github.com/tomdoestech/fastify-prisma-rest-api
authentication fastify nodejs prisma tutorial typescript
Last synced: 14 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/tomdoestech/fastify-prisma-rest-api
- Owner: TomDoesTech
- Created: 2022-02-27T02:51:00.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-12-11T21:13:46.000Z (about 2 years ago)
- Last Synced: 2025-01-24T00:12:38.642Z (14 days ago)
- Topics: authentication, fastify, nodejs, prisma, tutorial, typescript
- Language: TypeScript
- Homepage: https://youtu.be/LMoMHP44-xM
- Size: 99.6 KB
- Stars: 210
- Watchers: 3
- Forks: 61
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Build a REST API with Fastify & Prisma
Video: https://youtu.be/LMoMHP44-xM
## What are we using?
* Fastify - Web server
* Prisma - Database ORM
* Zod - Request and response validation
* Swagger - API docs
* TypeScript - Types & other cool stuff## What you will need
* [Postman](https://www.postman.com/) - Make API requests
* [Prisma studio](https://www.prisma.io/studio) - View data
* [PostreSQL or MySQL](https://github.com/tomanagle/awesome-docker-compose) - Database
* [Code editor](https://code.visualstudio.com/) - Edit your code## Features
* Create a user
* Login
* List users
* Create a product
* List products
* Authentication
* Request & response validation
* Swagger docs## Video structure
1. Demonstration
2. Code walk-through
3. Bootstrap application
* Setup Prisma
* Create Fastify instance
4. Create user
* Hash password
5. List users
6. Login
* fastify-jwt setup
7. Create product
8. List products# Testing
## What are we testing with?
* [Node Tap](https://node-tap.org/) - Test framework
* [fastify.inject](https://www.fastify.io/docs/latest/Guides/Testing/#benefits-of-using-fastifyinject) - Inject HTTP requests
* [faker-js](@faker-js/faker) - Generate test data
* [ts-mock-imports](https://www.npmjs.com/package/ts-mock-imports) - Mock imports## What will I learn?
* How to test your API end-to-end
* How to inject http requests to your Fastify application
* How to mock function calls
* How to test with a test database## Where can I learn more about testing Fastify?
* [Unit Test Patterns And Strategies](https://github.com/knockaway/unit-test-patterns-and-strategies)
* [Node Tap documentation](https://node-tap.org/docs/getting-started/)
* [Fastify documentation](https://www.fastify.io/docs/latest/Guides/Testing/)