Skip to content

frony/picamula

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

JuntaTribo - Multi-User Travel App

A comprehensive travel planning application built with modern technologies, designed to help groups plan and organize their trips together.

๐Ÿ—๏ธ Architecture Overview

Tech Stack

Backend:

  • NestJS - Scalable Node.js framework with TypeScript support
  • TypeScript - Type-safe development
  • PostgreSQL - Reliable relational database
  • TypeORM - Object-relational mapping with excellent TypeScript support
  • Redis - In-memory data store for sessions and caching

Frontend:

  • Next.js 14 - React framework with App Router
  • TypeScript - Type-safe development
  • TailwindCSS - Utility-first CSS framework
  • shadcn/ui - Beautiful and accessible UI components
  • Zustand - Lightweight state management

Monorepo:

  • Turbo - High-performance build system for monorepos

๐Ÿ“ Project Structure

junta-tribo/
โ”œโ”€โ”€ apps/
โ”‚   โ”œโ”€โ”€ api/                 # NestJS Backend API
โ”‚   โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ auth/        # Authentication module
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ users/       # User management module
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ trips/       # Trip management module
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ config/      # Configuration services
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ database/    # Database migrations
โ”‚   โ”‚   โ””โ”€โ”€ package.json
โ”‚   โ””โ”€โ”€ web/                 # Next.js Frontend
โ”‚       โ”œโ”€โ”€ src/
โ”‚       โ”‚   โ”œโ”€โ”€ app/         # App Router pages
โ”‚       โ”‚   โ”œโ”€โ”€ components/  # React components
โ”‚       โ”‚   โ”œโ”€โ”€ hooks/       # Custom React hooks
โ”‚       โ”‚   โ”œโ”€โ”€ lib/         # Utility libraries
โ”‚       โ”‚   โ””โ”€โ”€ store/       # State management
โ”‚       โ””โ”€โ”€ package.json
โ”œโ”€โ”€ packages/
โ”‚   โ”œโ”€โ”€ shared/              # Shared types and utilities
โ”‚   โ”‚   โ””โ”€โ”€ src/
โ”‚   โ”‚       โ”œโ”€โ”€ types.ts     # TypeScript interfaces
โ”‚   โ”‚       โ””โ”€โ”€ constants.ts # Shared constants
โ”‚   โ””โ”€โ”€ ui/                  # Shared UI components (future)
โ”œโ”€โ”€ docker-compose.yml       # Development services
โ”œโ”€โ”€ turbo.json              # Turbo configuration
โ””โ”€โ”€ package.json            # Root package.json

๐Ÿ” Security Features

Authentication & Authorization

  • JWT-based authentication with secure token storage
  • Session management with Redis for token validation
  • Password hashing using bcryptjs
  • Protected routes - All user-specific endpoints require authentication
  • User ownership validation - Users can only access their own data

API Security

  • CORS configuration for frontend-backend communication
  • Input validation using class-validator decorators
  • Error handling with proper HTTP status codes
  • Request/Response interceptors for consistent API behavior

๐Ÿš€ Core Features

User Management

  • Registration & Login with email/password
  • Profile management (update name, avatar)
  • Account deactivation option
  • User session tracking with Redis

Trip Management (CRUD Operations)

  • Create trips with detailed information:
    • Title, description, destination
    • Start/end dates with validation
    • Budget tracking
    • Participant management
    • Custom itinerary support
  • Read trips with filtering and sorting:
    • View all user trips
    • Filter by status (planning, confirmed, in-progress, completed, cancelled)
    • Upcoming trips view
    • Trip statistics dashboard
  • Update trips with partial updates supported
  • Delete trips with proper authorization

Trip Status Management

  • Planning - Initial trip creation phase
  • Confirmed - Trip details finalized
  • In Progress - Currently traveling
  • Completed - Trip finished
  • Cancelled - Trip cancelled

๐Ÿ› ๏ธ Development Setup

Prerequisites

  • Node.js 18+
  • PostgreSQL 15+
  • Redis 7+
  • npm or yarn

Environment Configuration

The project uses a single consolidated .env file at the root level that contains all environment variables for both frontend and backend applications. This simplifies configuration management and ensures consistency across the monorepo.

Quick Start

  1. Clone and install dependencies:
git clone <repository-url>
cd junta-tribo
npm install
  1. Start development services:
# Start PostgreSQL and Redis
docker-compose up -d

# Start development servers
npm run dev
  1. Environment setup:
# Manually: cp env.example .env
# Update .env with your configuration (database credentials, JWT secret, etc.)

Available Scripts

# Development
npm run dev          # Start all apps in development mode
npm run build        # Build all apps for production
npm run lint         # Run linting across all packages
npm run type-check   # Type checking across all packages

# Database (run from apps/api directory)
npm run migration:generate  # Generate new migration
npm run migration:run      # Run pending migrations

๐Ÿ”ง API Documentation

Authentication Endpoints

  • POST /auth/register - User registration
  • POST /auth/login - User login
  • POST /auth/logout - User logout
  • GET /auth/me - Get current user profile

User Endpoints

  • GET /users - Get all users (protected)
  • GET /users/:id - Get user by ID (protected)
  • PATCH /users/me - Update current user profile (protected)
  • DELETE /users/me - Deactivate current user (protected)

Trip Endpoints

  • GET /trips - Get all user trips (protected)
  • GET /trips/upcoming - Get upcoming trips (protected)
  • GET /trips/:id - Get trip by ID (protected)
  • POST /trips - Create new trip (protected)
  • PATCH /trips/:id - Update trip (protected)
  • DELETE /trips/:id - Delete trip (protected)

API Documentation

  • Swagger documentation available at /api/docs when running the backend
  • Interactive API testing and documentation

๐ŸŽจ Frontend Features

Responsive Design

  • Mobile-first approach with TailwindCSS
  • Responsive layouts that work on all device sizes
  • Touch-friendly interfaces for mobile users

User Experience

  • Modern UI with shadcn/ui components
  • Loading states and error handling
  • Toast notifications for user feedback
  • Form validation with real-time feedback
  • Dashboard with statistics and trip overview

State Management

  • Zustand store for authentication state
  • Persistent storage for user sessions
  • Optimistic updates for better UX

๐Ÿ“Š Database Schema

Users Table

  • id (UUID, Primary Key)
  • email (Unique, Not Null)
  • firstName (String, Not Null)
  • lastName (String, Not Null)
  • password (Hashed, Not Null)
  • avatar (String, Optional)
  • isActive (Boolean, Default: true)
  • createdAt (Timestamp)
  • updatedAt (Timestamp)

Trips Table

  • id (UUID, Primary Key)
  • title (String, Not Null)
  • description (Text, Optional)
  • destination (String, Not Null)
  • startDate (Date, Not Null)
  • endDate (Date, Not Null)
  • status (Enum: planning, confirmed, in_progress, completed, cancelled)
  • budget (Decimal, Optional)
  • participants (JSON Array, Optional)
  • itinerary (JSON Array, Optional)
  • ownerId (UUID, Foreign Key to Users)
  • createdAt (Timestamp)
  • updatedAt (Timestamp)

๐Ÿš€ Deployment Considerations

Environment Variables Structure

The root .env file is organized into sections:

  • Backend API Configuration: Server port, database, Redis, JWT settings
  • Frontend Web Configuration: API URL and other client-side variables
  • Development Services: URLs and ports for development tools

Production Setup

  • Copy env.example to .env and configure production values
  • Database migrations in production
  • Redis cluster setup for scaling
  • SSL/TLS certificates
  • Load balancing considerations
  • Monitoring and logging setup

Scaling Strategies

  • Horizontal scaling with multiple API instances
  • Database read replicas for improved performance
  • Redis clustering for session management
  • CDN integration for static assets
  • Caching strategies for frequently accessed data

๐Ÿ”ฎ Future Enhancements

Planned Features

  • Real-time collaboration with WebSocket support
  • File upload for trip photos and documents
  • Trip sharing with public links
  • Email notifications for trip updates
  • Mobile app with React Native
  • Third-party integrations (Google Maps, weather APIs)
  • Advanced trip planning with AI suggestions

Technical Improvements

  • GraphQL API for more flexible data fetching
  • Microservices architecture for better scalability
  • Event-driven architecture with message queues
  • Advanced caching strategies
  • Performance monitoring and analytics
  • Automated testing suite expansion

๐Ÿ“ Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests for new functionality
  5. Submit a pull request

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


JuntaTribo - Making travel planning collaborative and fun! ๐ŸŒโœˆ๏ธ

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages