The api-rest-guidex is a RESTful API developed in Node.js with Express and Prisma, which offers a complete CRUD system for database tables, with authentication and authorization using JWT (JSON Web Tokens). The project focuses on security, route organization, and clear documentation via Swagger.
- Node.js
- Express
- TypeScript
- Prisma ORM
- JWT (JSON Web Tokens) for authentication
- SQLite (or database configured in
.env) - Swagger (OpenAPI) for API documentation
- dotenv for managing environment variables
- Node.js (v16 or higher) installed
- npm or yarn
- Git
-
Clone the repository
git clone https://github.com/Nathanviana/API-REST-guideX.git cd api-rest-guidex -
Install dependencies
npm install # or yarn install -
Configure environment variables
Create a.envfile in the root of the project with the required variables, for example:DATABASE_URL="file:./dev.db" JWT_SECRET="your_secret_key_here" -
Run the database migrations
npx prisma migrate dev
-
Start the server
npm run dev # or yarn dev -
The API will be available at:
http://localhost:4000
/src
├── controllers/ # Endpoint logic
├── dtos/ # validators
├── factories/ # uses prisma
├── middlewares/ # Authentication and permission middlewares
├── routes/ # Route definitions
├── types/ # global types
└── index.ts # Server initialization
- The project uses refresh tokens to maintain secure sessions.
- Logging out invalidates the active token.
- The business rule unified the user and student tables into a single
Usertable to avoid redundancy. - A custom middleware controls permissions between regular users and administrators.
If you have any questions or suggestions, please open an issue in the repository or contact the developer.