Skip to content
deepakkahar007Public

About

the ultimate files storage and sharing platform

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

24 Commits

Folders and files

Repository files navigation

πŸš€ NodeDrive

A modern file storage and sharing platform built with cutting-edge technologies. Upload, store, and share your files with ease! πŸ“βœ¨


✨ Features

  • πŸ” Secure Authentication - Built with better-auth for robust user authentication
  • πŸ“€ File Upload - Drag & drop or click to upload files effortlessly
  • ☁️ Cloud Storage - S3-compatible storage with MinIO for scalable file management
  • 🎨 Beautiful UI - Modern, responsive interface built with Next.js and shadcn/ui
  • ⚑ Fast Performance - Powered by Bun runtime and Fastify for lightning-fast API responses
  • πŸ—„οΈ Reliable Database - PostgreSQL with Drizzle ORM for efficient data management
  • πŸ”„ Real-time Updates - Redis for caching and session management
  • πŸŒ™ Dark Mode - Built-in theme support for comfortable viewing
  • πŸ“± Responsive Design - Works seamlessly on desktop, tablet, and mobile devices

πŸ›  Tech Stack

Frontend

  • Framework: Next.js 16 (React 19) βš›οΈ
  • Styling: Tailwind CSS 4 🎨
  • UI Components: shadcn/ui, Base UI 🧩
  • State Management: Zustand, TanStack Query πŸ“Š
  • Forms: TanStack Form πŸ“
  • Type Safety: TypeScript 7 πŸ“˜

Backend

  • Runtime: Bun 1.4+ πŸ₯Ÿ
  • Framework: Fastify 5 ⚑
  • Database: PostgreSQL 🐘
  • ORM: Drizzle ORM πŸ—„οΈ
  • Cache: Redis πŸ”΄
  • Storage: MinIO (S3-compatible) ☁️
  • Authentication: better-auth πŸ”

Development Tools

  • Build System: Turborepo 2 πŸ—οΈ
  • Package Manager: Bun πŸ“¦
  • Linting: Biome πŸ”
  • Code Quality: Prettier ✨

πŸ— Architecture

graph TB
    subgraph "Client Layer"
        A[Next.js Frontend]
        A --> B[React Components]
        A --> C[TanStack Query]
    end

    subgraph "API Layer"
        D[Fastify Server]
        D --> E[Auth Routes]
        D --> F[File Routes]
        D --> G[User Routes]
    end

    subgraph "Service Layer"
        H[Auth Service]
        I[Storage Service]
        J[Database Service]
    end

    subgraph "Data Layer"
        K[(PostgreSQL)]
        L[(Redis)]
        M[(MinIO S3)]
    end

    A -->|HTTP/REST| D
    D --> H
    D --> I
    D --> J
    H --> K
    I --> M
    J --> K
    J --> L
    C -->|Caching| L
Loading

πŸ“‹ Requirements

  • Node.js: >= 24 🟒
  • Bun: >= 1.4.2 πŸ₯Ÿ
  • Docker: For running infrastructure services 🐳
  • Git: For version control πŸ“Œ

πŸš€ Getting Started

1. Clone the Repository

git clone <your-repo-url>
cd nodedrive

2. Install Dependencies

bun install

3. Start Infrastructure Services

docker-compose up -d

This will start:

  • PostgreSQL on port 5432 🐘
  • Redis on port 6379 πŸ”΄
  • MinIO on ports 9000 (API) and 9001 (Console) ☁️

4. Set Up Environment Variables

Create a .env.local file in apps/client/:

NEXT_PUBLIC_BETTER_AUTH_URL=http://localhost:3001

5. Run Database Migrations

cd packages/drizzle
bun run db:push

6. Start Development Servers

# Start all services (client + server)
bun run dev

# Or start individually:
# Client (Next.js)
cd apps/client && bun run dev

# Server (Fastify)
cd apps/server && bun run dev

7. Access the Application


πŸ“ Project Structure

nodedrive/
β”œβ”€β”€ apps/
β”‚   β”œβ”€β”€ client/              # Next.js frontend application
β”‚   β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”‚   β”œβ”€β”€ app/         # Next.js app router pages
β”‚   β”‚   β”‚   β”œβ”€β”€ components/  # Reusable UI components
β”‚   β”‚   β”‚   β”œβ”€β”€ hooks/       # Custom React hooks
β”‚   β”‚   β”‚   └── lib/         # Utility functions
β”‚   β”‚   └── public/          # Static assets
β”‚   β”‚
β”‚   └── server/              # Fastify backend application
β”‚       └── src/
β”‚           β”œβ”€β”€ config/      # Server configuration
β”‚           β”œβ”€β”€ lib/         # Utility functions
β”‚           β”œβ”€β”€ plugins/    # Fastify plugins
β”‚           └── routes/      # API routes
β”‚
β”œβ”€β”€ packages/
β”‚   β”œβ”€β”€ auth/                # Authentication library (better-auth)
β”‚   β”œβ”€β”€ drizzle/             # Database ORM (Drizzle)
β”‚   β”œβ”€β”€ env/                 # Environment configuration
β”‚   β”œβ”€β”€ eslint-config/       # Shared ESLint configuration
β”‚   β”œβ”€β”€ storage/             # S3 storage client
β”‚   └── typescript-config/   # Shared TypeScript configuration
β”‚
β”œβ”€β”€ s3_storage/              # MinIO storage directory
β”œβ”€β”€ docker-compose.yml       # Infrastructure services
β”œβ”€β”€ turbo.json              # Turborepo configuration
└── package.json            # Root package configuration

πŸ§ͺ Available Scripts

Root Level

bun run dev          # Start all services in development mode
bun run build        # Build all packages and apps
bun run lint         # Lint all packages and apps
bun run format       # Format code with Prettier
bun run check-types  # Type-check all packages and apps

Database (packages/drizzle)

bun run db:generate  # Generate database migrations
bun run db:migrate   # Run database migrations
bun run db:push      # Push schema changes to database
bun run db:studio    # Open Drizzle Studio

πŸ”§ Configuration

Environment Variables

Create a .env file in the root directory (optional):

# Database
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
POSTGRES_DB=postgres

# MinIO/S3
MINIO_ROOT_USER=admin
MINIO_ROOT_PASSWORD=password
S3_BUCKET=nodedrive

# Client URL
CLIENT_URL=http://localhost:3000 # Public site origin; used for canonical URLs and sitemap

🎯 Key Features Explained

Authentication πŸ”

Uses better-auth with Drizzle adapter for secure authentication. Supports:

  • Email/password authentication
  • Session management
  • Cookie-based auth

File Storage ☁️

Built on MinIO (S3-compatible) with AWS SDK:

  • Secure file uploads
  • Presigned URLs for direct access
  • Scalable storage solution

Database πŸ—„οΈ

PostgreSQL with Drizzle ORM:

  • Type-safe database queries
  • Automatic migrations
  • Optimized performance

πŸ› Troubleshooting

Database Connection Issues

# Check if PostgreSQL is running
docker-compose ps postgres

# Restart services
docker-compose restart

Port Already in Use

Change ports in docker-compose.yml or stop conflicting services.

Build Errors

# Clear cache and rebuild
rm -rf .next node_modules
bun install
bun run build

πŸ“ License

This project is private and proprietary. All rights reserved. Β© 2026


🀝 Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Run tests and linting
  5. Submit a pull request

πŸ“§ Support

For support, please open an issue in the repository or contact the development team.


Built with ❀️ using modern web technologies

About

the ultimate files storage and sharing platform

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages