Skip to content

TRAINIUM - This a NextJS turborepo app including web app and socket server offering the client pages and admin pages offering the modern and user friendly design.

Notifications You must be signed in to change notification settings

azizbekdevuz/trainium

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

98 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Trainium E-Commerce Platform

A modern, full-stack e-commerce platform built for selling high-tech fitness equipment. Trainium features a comprehensive product catalog, shopping cart, checkout system, real-time notifications, and an admin panel for managing all aspects of the business.

πŸ—οΈ Architecture

For a comprehensive overview of the system architecture, design patterns, and implementation details, see the Architecture Documentation.

✨ Features

  • E-Commerce Core

    • Product catalog with variants, categories, and inventory management
    • Shopping cart with guest and authenticated user support
    • Multi-provider payment processing (Stripe, Toss Payments)
    • Order management and tracking
    • Product recommendations engine
  • User Management

    • Multi-provider authentication (Google, Kakao, Email/Password)
    • Role-based access control (Admin, Staff, Customer)
    • User profiles and account management
  • Real-Time Features

    • Socket.IO-based notification system
    • Real-time order updates
    • Product alerts and system notifications
  • Admin Panel

    • Dashboard with analytics and statistics
    • Product, order, and customer management
    • Category and FAQ management
    • Low stock alerts and inventory tracking
  • Social Features

    • Product reviews and ratings
    • Favorites and likes
    • Review replies and interactions
  • Internationalization

    • Multi-language support (English, Korean, Uzbek)
    • URL-based locale routing
    • Translated email notifications

πŸ› οΈ Tech Stack

  • Frontend: Next.js 15.5, React 19, TypeScript, Tailwind CSS
  • Backend: Next.js API Routes, Express.js
  • Database: PostgreSQL with Prisma ORM
  • Authentication: NextAuth.js 5.0
  • Real-Time: Socket.IO
  • Payments: Stripe, Toss Payments
  • Email: Resend
  • Build System: Turbo (Monorepo)
  • Package Manager: pnpm

πŸ“ Project Structure

trainium/
β”œβ”€β”€ apps/
β”‚   β”œβ”€β”€ web/              # Next.js web application
β”‚   └── socket/            # Socket.IO server
β”œβ”€β”€ apps/packages/
β”‚   β”œβ”€β”€ shared/            # Shared utilities
β”‚   └── tsconfig/          # Shared TypeScript configs
β”œβ”€β”€ prisma/                # Database schema
β”œβ”€β”€ scripts/               # Build scripts
└── architecture.md       # Architecture documentation

πŸš€ Getting Started

Prerequisites

  • Node.js 18+
  • pnpm 9.0.6+
  • PostgreSQL database
  • Docker (optional, for containerized deployment)

Installation

  1. Clone the repository:
git clone <repository-url>
cd trainium
  1. Install dependencies:
pnpm install
  1. Set up environment variables:
cp .env.example .env
# Edit .env with your configuration

Required environment variables:

  • DATABASE_URL: PostgreSQL connection string
  • AUTH_SECRET: NextAuth secret key
  • GOOGLE_CLIENT_ID / GOOGLE_CLIENT_SECRET: Google OAuth credentials
  • KAKAO_CLIENT_ID / KAKAO_CLIENT_SECRET: Kakao OAuth credentials
  • STRIPE_SECRET_KEY / NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY: Stripe credentials
  • TOSS_CLIENT_KEY / TOSS_SECRET_KEY: Toss Payments credentials
  • RESEND_API_KEY: Resend email service key
  • NEXTAUTH_URL: Application URL
  • SOCKET_ADMIN_SECRET: Socket server admin secret

Docker Deployment

Important Security Note: Environment variables are handled securely:

  • .env files are NOT copied into Docker images
  • Build-time variables (NEXT_PUBLIC_*) are passed via build args
  • Runtime variables are loaded via env_file in docker-compose

Building with Docker Compose:

  1. Ensure your .env file exists in the project root with all required variables

  2. Build and start services:

    docker-compose up -d --build
  3. Set up the database:

# Generate Prisma client
pnpm --filter @apps/web prisma:generate

# Run migrations (or push schema)
pnpm --filter @apps/web prisma:push
  1. Start development servers:
# Start both web and socket servers
pnpm dev

# Or start individually
pnpm dev:web      # Web app on http://localhost:3000
pnpm dev:socket   # Socket server on http://localhost:4000

πŸ“ Available Scripts

Root Level

  • pnpm dev - Start all services in development mode
  • pnpm build - Build all applications
  • pnpm start - Start all services in production mode
  • pnpm lint - Lint all code
  • pnpm typecheck - Type check all TypeScript code

Web Application

  • pnpm dev:web - Start Next.js dev server
  • pnpm start:web - Start Next.js production server
  • pnpm --filter @apps/web prisma:studio - Open Prisma Studio

Socket Server

  • pnpm dev:socket - Start Socket.IO server
  • pnpm start:socket - Start Socket.IO server in production

🐳 Docker Deployment

The project includes Docker configuration for containerized deployment:

# Build and start all services
docker-compose up -d

# View logs
docker-compose logs -f

# Stop services
docker-compose down

πŸ“š Documentation

πŸ” Authentication

The platform supports multiple authentication methods:

  • Google OAuth: Social login via Google
  • Kakao OAuth: Korean social login
  • Email/Password: Traditional credentials authentication

All authentication is handled via NextAuth.js with JWT session strategy.

πŸ’³ Payment Processing

The platform integrates with two payment providers:

  • Stripe: International payment processing
  • Toss Payments: Korean payment gateway

Both providers support multiple currencies and handle zero-decimal currencies (KRW, JPY, VND) correctly.

🌐 Internationalization

The platform supports three languages:

  • English (en) - Default
  • Korean (ko)
  • Uzbek (uz)

Locale routing is URL-based (/en/..., /ko/..., /uz/...) with cookie-based preference storage.

πŸ“§ Email Notifications

Email notifications are sent via Resend for:

  • Order confirmations
  • Order status updates
  • Shipping notifications

πŸ”” Real-Time Notifications

The platform includes a real-time notification system powered by Socket.IO:

  • User-specific notifications
  • Order update notifications
  • Product alerts
  • System-wide announcements

πŸ§ͺ Development

Code Structure

  • Components: Reusable React components in apps/web/src/components/
  • API Routes: Next.js API routes in apps/web/src/app/api/
  • Business Logic: Core logic in apps/web/src/lib/
  • Types: TypeScript definitions in apps/web/src/types/

Database Management

# Open Prisma Studio
pnpm --filter @apps/web prisma:studio

# Generate ERD diagram
pnpm erd:generate

πŸ“„ License

MIT License

🀝 Contributing

[I will update soon]

πŸ“ž Support

[Refer to my GitHub profile links for contact and support]

About

TRAINIUM - This a NextJS turborepo app including web app and socket server offering the client pages and admin pages offering the modern and user friendly design.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published