Skip to content

in2ai/ASM2-central

Repository files navigation

ASM2-Central 📊

In2AI - The AI Expert Place

A modern web application built with Next.js, tRPC, Tailwind CSS, and MongoDB for data persistence.

Tech Stack

  • Next.js - React framework with App Router
  • tRPC - End-to-end typesafe APIs
  • Tailwind CSS - Utility-first CSS framework
  • MongoDB - Document database with Mongoose ODM
  • TypeScript - Type safety across the stack
  • Bun - Fast JavaScript runtime and package manager

Getting Started

Prerequisites

  • Bun (recommended) or Node.js 18+
  • Docker and Docker Compose (for containerized setup)

Local Development

Option 1: Local Development with External MongoDB

  1. Install dependencies:

    bun install
  2. Set up environment variables:

    • Configure your MongoDB connection string in .env
  3. Start the development server:

    bun run dev
  4. Seed the database (optional):

    bun run seed

The application will be available at http://localhost:3000.

Option 2: Docker Compose (Recommended)

This setup includes MongoDB and handles all dependencies automatically.

  1. Start all services:

    bun run docker:up
  2. Seed the database:

    bun run docker:seed
  3. Stop all services:

    bun run docker:stop

The application will be available at http://localhost:3001.

Available Scripts

Development Scripts

  • bun run dev - Start development server with Turbo
  • bun run build - Build the application for production
  • bun run start - Start production server
  • bun run preview - Build and start production server

Database Scripts

  • bun run seed - Seed the database with sample data

Docker Scripts

  • bun run docker:up - Start MongoDB and web services
  • bun run docker:seed - Run database seeding in Docker
  • bun run docker:dev - Start all services including seeding
  • bun run docker:stop - Stop all Docker services

Code Quality Scripts

  • bun run lint - Run ESLint
  • bun run lint:fix - Fix ESLint issues automatically
  • bun run typecheck - Run TypeScript type checking
  • bun run format:check - Check code formatting
  • bun run format:write - Format code with Prettier

Testing Scripts (Not Yet Implemented)

  • bun run test - Run Playwright tests
  • bun run test:ui - Run Playwright tests with UI

Project Structure

├── src/
│   ├── app/          # Next.js App Router pages
│   ├── components/   # Reusable React components
│   ├── lib/          # Utility functions and configurations
│   ├── models/       # MongoDB/Mongoose models
│   ├── server/       # tRPC server setup and routers
│   └── env.js        # Environment variable validation
├── scripts/
│   ├── seed.ts       # Database seeding script
│   └── metrics-seed-data.json
├── docker-compose.yml
├── Dockerfile        # Production build
└── Dockerfile.seed   # Database seeding container

Environment Variables

Create a .env file in the root directory with the following variables:

Required Variables

# Database Connection (Required)
MONGODB_URI="mongodb://admin:password@localhost:27017/asm2?authSource=admin"

# Application Environment (Required)
NODE_ENV="development"

Optional Variables

# MongoDB Configuration (Used by Docker Compose)
MONGODB_USER="admin"
MONGODB_PASSWORD="password" 
MONGODB_DATABASE="asm2"

# Development Settings
SKIP_ENV_VALIDATION="false"

Variable Descriptions

  • MONGODB_URI: Complete MongoDB connection string. Required for database connectivity.
  • NODE_ENV: Application environment (development, test, or production). Required.
  • MONGODB_USER: MongoDB username. Used by Docker Compose setup (defaults to admin).
  • MONGODB_PASSWORD: MongoDB password. Used by Docker Compose setup (defaults to password).
  • MONGODB_DATABASE: MongoDB database name. Used by Docker Compose setup (defaults to asm2).
  • SKIP_ENV_VALIDATION: Skip environment variable validation during build. Useful for Docker builds (defaults to false).

Example Configurations

Local Development with External MongoDB

MONGODB_URI="mongodb://localhost:27017/asm2"
NODE_ENV="development"

Docker Compose Setup

MONGODB_USER="admin"
MONGODB_PASSWORD="your-secure-password"
MONGODB_DATABASE="asm2"
NODE_ENV="development"

Docker Configuration

The project includes two Docker setups:

  • Main Application (Dockerfile): Optimized production build with standalone output
  • Database Seeding (Dockerfile.seed): Separate container for running database migrations and seeding

The docker-compose setup automatically:

  • Starts MongoDB with persistent data
  • Builds and runs the Next.js application
  • Configures networking between services
  • Provides health checks for reliable startup

About

Servidor central proyecto ACM2

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors