Skip to content

icocampos/nlw-agents-back-end

Repository files navigation

NLW Agents

This project was developed during Rocketseat's Next Level Week (NLW) event, focusing on building a modern, robust, and efficient API using cutting-edge technologies.

🚀 Technologies Used

  • Node.js with native TypeScript (--experimental-strip-types)
  • Fastify – High-performance web framework
  • PostgreSQL with pgvector extension for vector support
  • Drizzle ORM – Type-safe ORM for database operations
  • Zod – Schema validation with static typing
  • Docker – Containerized database
  • Biome – Code linting and formatting

🏗️ Architecture

The project follows a clean and modular architecture:

  • Clear separation between routes, schemas, and database logic
  • Schema validation with Zod for type safety
  • Type-safe database operations with Drizzle
  • Centralized environment variable validation

⚙️ Setup and Configuration

Prerequisites

  • Node.js (with support for --experimental-strip-types)
  • Docker and Docker Compose

Steps

  1. Clone the repository:
git clone <repo-url>
cd server
  1. Start the database with Docker:
docker-compose up -d
  1. Create a .env file in the root folder with the following content:
PORT=3333
DATABASE_URL=postgresql://docker:docker@localhost:5432/agents
  1. Install the dependencies:
npm install
  1. Run the database migrations:
npx drizzle-kit migrate
  1. (Optional) Seed the database with sample data:
npm run db:seed
  1. Start the project:

Development mode:

npm run dev

Production mode:

npm start

📚 Available Scripts

  • npm run dev – Runs the server in development mode with hot reload
  • npm start – Runs the server in production mode
  • npm run db:seed – Seeds the database with sample data

🌐 Available Endpoints

The API will be running at: http://localhost:3333

About

Projeto desenvolvido durante o NLW Agents da Rocketseat

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published