Skip to content

xcodedi/allegre-api

Repository files navigation

Allegre - API (BACK_END)

Introduction

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.

Features

  • 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, and ORG_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.

Dependencies

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.

Setup and Configuration

Configuration of the Database

  1. 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
  2. Create a .env file in the project root directory with the following content:

    DATABASE_URL=postgresql://docker:docker@localhost:5432/allegre-api

Running the Project

  1. Clone the repository:

    git clone https://github.com/xcodedi/allegre-api.git
  2. Navigate to the project folder and install dependencies:

    cd allegre-api
    yarn install
  3. Run Prisma migrations to set up the database schema:

    yarn prisma migrate deploy
  4. Optionally, seed the database with initial data:

    yarn prisma db seed
  5. Run the project in development mode:

    yarn start:dev
  6. Run the project in production mode:

    yarn start

API Documentation

The API documentation is available via Swagger UI. After starting the server, you can access it at:

http://localhost:3000/api

Usage

You can test the API endpoints directly from the Swagger documentation.

About

API using Node.js, Nest.js, Prisma

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors