Skip to content

Natanaelvich/ai-ask-recorder-live_rocketseat-25

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

30 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

NLW Agents - Rocketseat 25

A full-stack referral and Q&A system built for events, featuring intelligent agents for automated question-answering and a comprehensive ranking system for referrals.

๐Ÿš€ Overview

NLW Agents is a comprehensive platform that combines event registration with referral tracking and AI-powered Q&A functionality. Users can subscribe to events, invite others through referral links, and interact with AI agents to get answers to their questions.

โœจ Features

๐ŸŽฏ Core Features

  • Event Subscription System - Register users for events with email validation
  • Referral Program - Track invitations and maintain referral rankings
  • AI-Powered Q&A - Create rooms for questions and get AI-generated responses
  • Audio Recording - Record audio questions for enhanced interaction
  • Real-time Ranking - Live leaderboard for referral performance

๐Ÿ”ง Technical Features

  • REST API - Complete backend API with Swagger documentation
  • Real-time Data - Redis-backed ranking and caching system
  • Database Management - PostgreSQL with Drizzle ORM
  • Modern Frontend - React 19 with TypeScript and TailwindCSS
  • Container Support - Docker Compose for easy deployment

๐Ÿ“ธ Screenshots

๐Ÿ  Home Page - Room Listing

Home Page

๐Ÿ† Room Question

Ranking System

๐ŸŽค Room Audio Recording

Q&A Room

๐Ÿ“‹ Table Questions

Audio Recording

๐Ÿ“‹ Table Chunkings Audio

Create Room

๐Ÿ› ๏ธ Tech Stack

Backend

  • Runtime: Node.js with TypeScript
  • Framework: Fastify
  • Database: PostgreSQL with Drizzle ORM
  • Cache: Redis
  • Validation: Zod
  • Authentication: JWT
  • Documentation: Swagger/OpenAPI

Frontend

  • Framework: React 19
  • Language: TypeScript
  • Styling: TailwindCSS
  • State Management: TanStack React Query
  • Routing: React Router DOM
  • UI Components: Radix UI + Shadcn/ui
  • Forms: React Hook Form with Zod validation
  • Icons: Lucide React

DevOps

  • Containerization: Docker Compose
  • Code Quality: Biome (linting & formatting)
  • Build Tool: Vite (frontend) + tsup (backend)

๐Ÿ“ Project Structure

โ”œโ”€โ”€ backend/                 # API server
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ drizzle/        # Database schema and migrations
โ”‚   โ”‚   โ”œโ”€โ”€ functions/      # Business logic
โ”‚   โ”‚   โ”œโ”€โ”€ routes/         # API endpoints
โ”‚   โ”‚   โ”œโ”€โ”€ redis/          # Redis client configuration
โ”‚   โ”‚   โ””โ”€โ”€ server.ts       # Server entry point
โ”‚   โ”œโ”€โ”€ docker-compose.yml  # Infrastructure services
โ”‚   โ””โ”€โ”€ package.json
โ”‚
โ”œโ”€โ”€ frontend/               # React application
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ components/     # React components
โ”‚   โ”‚   โ”œโ”€โ”€ pages/          # Page components
โ”‚   โ”‚   โ”œโ”€โ”€ http/           # API client and types
โ”‚   โ”‚   โ”œโ”€โ”€ lib/            # Utilities
โ”‚   โ”‚   โ””โ”€โ”€ main.tsx        # App entry point
โ”‚   โ””โ”€โ”€ package.json
โ”‚
โ””โ”€โ”€ README.md              # This file

๐Ÿš€ Getting Started

Prerequisites

  • Node.js 18+
  • Docker and Docker Compose
  • npm or yarn

Installation

  1. Clone the repository

    git clone <repository-url>
    cd nlw-agents-rocketseat-25
  2. Start the infrastructure services

    cd backend
    docker-compose up -d
  3. Set up the backend

    # Install dependencies
    npm install
    
    # Set up environment variables
    cp .env.example .env
    # Edit .env with your configuration
    
    # Run database migrations
    npm run db:migrate
    
    # Start development server
    npm run dev
  4. Set up the frontend

    cd ../frontend
    
    # Install dependencies
    npm install
    
    # Start development server
    npm run dev

Environment Variables

Create a .env file in the backend directory:

# Server
PORT=3333

# Database
DATABASE_URL=postgresql://docker:docker@localhost:5432/connect

# Redis
REDIS_URL=redis://localhost:6379

# URLs
API_URL=http://localhost:3333
WEB_URL=http://localhost:5173

๐ŸŽฎ Usage

API Endpoints

The backend provides several key endpoints:

  • POST /subscriptions - Subscribe to events
  • GET /ranking - Get referral rankings
  • GET /invites/:subscriberId - Access referral links
  • GET /subscribers/:id/ranking/* - Get subscriber metrics

Frontend Routes

  • / - Home page with room listing
  • /create-room - Create new Q&A rooms
  • /room/:roomId - Q&A room interface
  • /room/:roomId/audio - Audio recording interface

Development

Backend Development

cd backend
npm run dev          # Start with hot reload
npm run db:generate  # Generate database migrations
npm run db:migrate   # Run migrations
npm run build        # Build for production

Frontend Development

cd frontend
npm run dev          # Start development server
npm run build        # Build for production
npm run preview      # Preview production build

๐Ÿ“Š Key Features Explained

Referral System

  • Users can invite others through unique referral links
  • Referrals are tracked and scored using Redis
  • Real-time ranking system shows top referrers
  • Automatic scoring when referrals are successful

Q&A System

  • Create rooms for organized question sessions
  • AI-powered responses to user questions
  • Audio recording capabilities for enhanced interaction
  • Real-time question management

Database Schema

  • subscriptions table for user management
  • Redis for high-performance ranking data
  • Drizzle ORM for type-safe database operations

๐Ÿ”ง API Documentation

Once running, visit http://localhost:3333/docs to access the interactive Swagger documentation.

๐Ÿณ Docker Support

The project includes Docker Compose configuration for easy infrastructure setup:

cd backend
docker-compose up -d  # Starts PostgreSQL and Redis

๐Ÿค Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

๐Ÿ“„ License

This project is part of the NLW (Next Level Week) event by Rocketseat.

๐ŸŽฏ Event Information

This project was developed during NLW Agents event by Rocketseat, demonstrating modern web development practices with intelligent agents and real-time systems.

About

Full-stack referral and Q&A system built for events, featuring intelligent agents for automated question-answering and a comprehensive ranking system for referrals

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors