remediios/fastify-prisma-rest-api(新しいタブで開きます)
主要言語: TypeScript
Fastify API boilerplate with Typescript, Prisma ORM, Zod and Swagger
- star 数
- 8
- watcher 数
- 1
- fork 数
- 3
- issue 数
- 0
- 最終更新
- 2024/03/07
主要言語: TypeScript
Fastify API boilerplate with Typescript, Prisma ORM, Zod and Swagger
This project is a boilerplate codebase for building a RESTful API using Fastify, Prisma, Zod, and TypeScript. This project includes user and product management endpoints, authentication, request and response validation, and Swagger documentation.
Before getting started with the project, ensure you have the following tools installed:
The project boasts the following features:
To get started with the project, follow the instructions below:
Clone the repository: https://github.com/remediios/fastify-prisma-rest-api.git
Navigate to the project directory: cd fastify-prisma-rest-api
Install the dependencies: yarn install
Create a .env file with the following credentials:
# .env Example # PostgreSQL Database URL DATABASE_URL="postgresql://postgres:<yourDBPassword>@localhost:5432/fastify-prisma-rest-api?schema=public" # JWT Secret for Authentication JWT_SECRET="Your random JWT Secret up to your choice"
Check the docker-compose.yml file and change any properties you'd like, e.g. POSTGRES_PASSWORD for any of your choice. (it should match the .env Database URL password)
Start your Docker PostgreSQL container with docker compose up -d (-d to run in the background)
Push the Prisma schema to reflect on the PostgreSQL Database with npx prisma db push or npx prisma migrate dev --name init (for historical migration's records)
Run the application with yarn dev
Lastly, if needed, import the Postman collection file example Fastify Prisma API.postman_collection.json into your Postman environment to facilitate API testing.
After completing these steps, you should be able to run this project locally. If you encounter any issues or have any questions, please don't hesitate to reach out.
After running the application, you can access it at http://localhost:3000/documentation. Explore the API using Postman, test the functionality, and refer to the Swagger documentation for endpoint details.
Contributions to the project are more than welcome. Please submit a pull request with a detailed description of your changes.
Fastify-Prisma-Rest-API is open-source software licensed under the MIT License.
For any questions or feedback, please reach out to miguelremediioss@gmail.com.