Skip to content

A secure cloud storage app built with Next.js, TypeScript, and PostgreSQL, featuring real-time file management, Clerk authentication, and a modern, responsive UI.

License

Notifications You must be signed in to change notification settings

CodewithEvilxd/FileNest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

12 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ FileNest - Secure Cloud Storage for Everyone

FileNest Dashboard

A full-stack cloud storage platform built with Next.js 15, featuring real-time file management, user authentication, and a sleek modern interface.

Next.js TypeScript Tailwind CSS PostgreSQL Clerk ImageKit Framer Motion Three.js

✨ Features

🎯 Core Functionality

  • πŸ” Secure Authentication - Powered by Clerk with email verification and OTP support
  • πŸ“ File Management - Upload, organize, star, and delete files with drag-and-drop support
  • πŸ“‚ Folder Structure - Create and navigate through nested folder hierarchies
  • πŸ’Ύ Storage Management - 150MB per user limit with real-time usage tracking
  • πŸ—‘οΈ Trash System - Soft delete with restore functionality

🎨 User Experience

  • 🎭 Modern UI - Clean, minimal design inspired by Apple's aesthetics
  • πŸ“± Responsive Design - Works seamlessly across desktop, tablet, and mobile
  • ⚑ Real-time Updates - Instant feedback for all file operations
  • 🧠 Smart Validation - Pre-upload file size and type validation
  • πŸ“Š Progress Tracking - Visual upload progress with error handling

πŸ› οΈ Technical Features

  • πŸ”’ Type-Safe - Full TypeScript implementation
  • πŸ—„οΈ Database Integration - PostgreSQL with Drizzle ORM
  • ☁️ Cloud Storage - Quadruple redundancy with ImageKit + Cloudinary fallback
  • πŸš€ Performance - Optimized with Next.js 15 and Turbopack
  • πŸ›‘οΈ Security - Protected API routes with user authorization
  • 🎨 File Type Colors - Different colors for PDF, images, videos, and documents
  • πŸ“§ Contact System - Email notifications with IP tracking
  • πŸ” Login Monitoring - Silent user activity tracking (admin only)

Project Structure

filenest/
β”œβ”€β”€ πŸ“‚ app/                    # Next.js App Router
β”‚   β”œβ”€β”€ πŸ“‚ api/                # API Routes
β”‚   β”‚   β”œβ”€β”€ files/             # File operations (upload, delete, star, trash)
β”‚   β”‚   β”œβ”€β”€ folders/           # Folder management
β”‚   β”‚   └── storage/           # Storage usage tracking
β”‚   β”œβ”€β”€ dashboard/             # Main app interface
β”‚   β”œβ”€β”€ login/                 # Authentication pages
β”‚   └── page.tsx               # Landing page
β”œβ”€β”€ πŸ“‚ components/             # React Components
β”‚   β”œβ”€β”€ ui/                    # shadcn/ui base components
β”‚   β”œβ”€β”€ FileUploadForm.tsx     # Upload interface with storage limits
β”‚   β”œβ”€β”€ FileList.tsx           # File management table
β”‚   β”œβ”€β”€ StorageIndicator.tsx   # Storage usage display
β”‚   └── ...                    # Other UI components
β”œβ”€β”€ πŸ“‚ database/               # Database setup
β”‚   β”œβ”€β”€ schema.ts              # File & user data models
β”‚   └── drizzleClient.ts       # DB connection
β”œβ”€β”€ πŸ“‚ lib/                    # Utilities
β”‚   └── storageUtils.ts        # 150MB limit calculations
└── πŸ“„ Config files            # ENV, TypeScript, Tailwind, etc.

Getting Started

Prerequisites

  • Node.js (v18 or higher)
  • pnpm (recommended) or npm
  • PostgreSQL database
  • ImageKit + Cloudinary accounts for redundant file storage
  • Clerk account for authentication

1. Clone the Repository

git clone https://github.com/CodewithEvilxd/FileNest.git
cd FileNest

2. Install Dependencies

# Using pnpm (recommended)
pnpm install

# Or using npm
npm install

3. Environment Setup

Copy the sample environment file and configure your variables:

cp .env.sample .env

Add your environment variables to .env:

# Database Configuration
DATABASE_URL="postgresql://username:password@host:port/database?sslmode=require"

# Clerk Authentication
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY="pk_test_..."
CLERK_SECRET_KEY="sk_test_..."
NEXT_PUBLIC_CLERK_SIGN_IN_URL="/sign-in"
NEXT_PUBLIC_CLERK_SIGN_UP_URL="/sign-up"
NEXT_PUBLIC_CLERK_AFTER_SIGN_IN_URL="/dashboard"
NEXT_PUBLIC_CLERK_AFTER_SIGN_UP_URL="/dashboard"

# ImageKit Configuration (Primary)
NEXT_PUBLIC_IMAGEKIT_PUBLIC_KEY="your_public_key"
IMAGEKIT_PRIVATE_KEY="your_private_key"
NEXT_PUBLIC_IMAGEKIT_URL_ENDPOINT="https://ik.imagekit.io/your_imagekit_id"

# ImageKit Configuration (Secondary - Fallback)
IMAGEKIT2_PUBLIC_KEY="your_second_public_key"
IMAGEKIT2_PRIVATE_KEY="your_second_private_key"
IMAGEKIT2_URL_ENDPOINT="https://ik.imagekit.io/your_second_id"

# ImageKit Configuration (Tertiary - Second Fallback)
IMAGEKIT3_PUBLIC_KEY="your_third_public_key"
IMAGEKIT3_PRIVATE_KEY="your_third_private_key"
IMAGEKIT3_URL_ENDPOINT="https://ik.imagekit.io/your_third_id"

# Cloudinary Configuration (Final Fallback)
CLOUDINARY_CLOUD_NAME="your_cloud_name"
CLOUDINARY_API_KEY="your_api_key"
CLOUDINARY_API_SECRET="your_api_secret"

4. Database Setup

# Generate and run database migrations
pnpm drizzle-kit generate
pnpm drizzle-kit migrate

5. Start Development Server

# Using pnpm
pnpm dev

# Or using npm
npm run dev

Visit http://localhost:3000 to see your application running!

πŸ› οΈ Technology Stack

Frontend

Backend & Database

Authentication & Storage

  • Clerk - User authentication and management
  • ImageKit - Primary cloud storage with redundancy
  • Cloudinary - Backup cloud storage

Development Tools

Available Scripts

# Development
pnpm dev          # Start development server with Turbopack
pnpm build        # Build for production
pnpm start        # Start production server
pnpm lint         # Run ESLint

# Database
pnpm db:generate  # Generate database migrations
pnpm db:migrate   # Run database migrations
pnpm db:studio    # Open Drizzle Studio (database GUI)

API Endpoints

File Management

  • GET /api/files - List user files and folders
  • POST /api/files/upload - Upload new files
  • POST /api/files/[fileId]/star - Toggle file star status
  • POST /api/files/[fileId]/trash - Move file to trash
  • DELETE /api/files/[fileId]/delete - Permanently delete file
  • POST /api/files/empty-trash - Empty trash folder

Folder Management

  • POST /api/folders/create - Create new folder

Storage Management

  • GET /api/storage/usage - Get current storage usage

Authentication

  • GET /api/imagekit-auth - Get ImageKit authentication token

🀝 Contributing

We welcome contributions! Here's how you can help:

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

Development Guidelines

  • Follow TypeScript best practices
  • Write meaningful commit messages
  • Test your changes thoroughly
  • Update documentation as needed

πŸ“ž Contact & Support

πŸ“„ License

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


Built with ❀️ by CodewithEvilxd

Star ⭐ this repo if you found it helpful!

About

A secure cloud storage app built with Next.js, TypeScript, and PostgreSQL, featuring real-time file management, Clerk authentication, and a modern, responsive UI.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published