Allegre API provides a platform for managing student organizations. It includes functionalities for managing organizations, users, and roles within an organization. The API supports various levels of user permissions and provides validation for data entry.
- User Authentication: Secure user authentication with role-based access control.
- Organization Management: CRUD operations for managing organizations, including their names, CNPJ, logos, and contact details.
- Role-Based Access Control: Users have roles such as
SUPER_ADMIN,ORG_ADMIN,ORG_MEMBER,ORG_TEACHER,ORG_PARENT, andORG_STUDENT, each with different permissions. - Data Validation: Ensures that the data entered into the system meets predefined criteria.
- Swagger Documentation: Interactive API documentation for testing endpoints directly from the browser.
To run the API, you need the following dependencies:
- Docker - Containerization platform for developing, shipping, and running applications.
- Node.js - JavaScript runtime environment.
- NestJS - Framework for building efficient and scalable server-side applications.
- Prisma - ORM for database management.
- PostgreSQL - Relational database management system.
- Bcrypt - Library to hash passwords.
- Jsonwebtoken - Library for creating and verifying JSON Web Tokens.
- Swagger - API documentation and testing tool.
-
Create a PostgreSQL instance using Docker:
docker run --name postgres-allegre-api -e POSTGRES_PASSWORD=docker -e POSTGRES_USER=docker -p 5432:5432 -d -t postgres
-
Create a
.envfile in the project root directory with the following content:DATABASE_URL=postgresql://docker:docker@localhost:5432/allegre-api
-
Clone the repository:
git clone https://github.com/xcodedi/allegre-api.git
-
Navigate to the project folder and install dependencies:
cd allegre-api yarn install -
Run Prisma migrations to set up the database schema:
yarn prisma migrate deploy
-
Optionally, seed the database with initial data:
yarn prisma db seed
-
Run the project in development mode:
yarn start:dev
-
Run the project in production mode:
yarn start
The API documentation is available via Swagger UI. After starting the server, you can access it at:
http://localhost:3000/api
You can test the API endpoints directly from the Swagger documentation.