Skip to content

rillToMe/PeakDrive

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

PeakDrive πŸš€

.NET React PostgreSQL License Status

PeakDrive is a private team drive system built with .NET 8 WebAPI and React (Vite).

It is designed for internal organizations where accounts are created only by administrators (no public registration).

  • Files are stored directly on server-side storage
  • Metadata and permissions are managed in PostgreSQL

✨ Features

  • Admin-only user creation (no open signup)
  • Secure authentication with JWT
  • Folder and file management system
  • Upload, download, and preview support
  • Public share links via token
  • Built-in Health Check diagnostics
  • Clean separation between backend API and frontend UI

πŸ— Architecture Overview

flowchart TD

    UI[Frontend UI<br/>React + Vite + Tailwind] -->|HTTP Requests| API[Backend API<br/>ASP.NET Core WebAPI]

    API -->|Metadata| DB[(PostgreSQL Database)]
    API -->|Files Stored| ST[Server Storage<br/>storage/ folder]

    API -->|Public Share Links| Share[Token Share Endpoint]
Loading

πŸ›  Tech Stack

Backend

  • ASP.NET Core 8 WebAPI
  • Entity Framework Core
  • PostgreSQL (Npgsql Provider)
  • JWT Authentication
  • Swagger Documentation

Frontend

  • React + Vite
  • Tailwind CSS
  • Axios
  • React Router
  • FontAwesome
  • React Three Fiber

πŸ“‚ Project Structure

peakdrive/
β”œβ”€β”€ ditDriveAPI/     # Backend (.NET 8 API)
└── frontend/        # Frontend (React + Vite)

βš™οΈ Backend Setup

Configuration Sources

PeakDrive supports configuration via:

βœ… appsettings.json
βœ… Environment Variables (recommended for production)

Main config file:

ditDriveAPI/appsettings.json

Required Config Keys

Key Description
Jwt:Key Secret key for token signing
Jwt:Issuer Token issuer name
Jwt:Audience Token audience
ConnectionStrings:Default PostgreSQL connection string
Storage:RootPath Root folder for file storage
Share:BaseUrl Base URL for public share links

Environment Variable Example (Production)

Jwt__Key=SUPER_SECRET_KEY
Jwt__Issuer=PeakDrive
Jwt__Audience=PeakDriveUsers

ConnectionStrings__Default=Host=...;Database=...;Username=...;Password=...

Storage__RootPath=storage/
Share__BaseUrl=https://your-domain.com

Seed__MasterEmail=root@767
Seed__MasterPassword=765

βœ… Double underscore (__) maps to nested JSON keys automatically in ASP.NET Core.


Master Admin Seeding (Optional)

If database is empty, PeakDrive can auto-create a Master Admin account:

Seed__MasterEmail=admin@peakdrive.local
Seed__MasterPassword=strongpassword

If not provided, seeding is skipped automatically.


Run Backend

cd ditDriveAPI

dotnet tool restore
dotnet ef database update
dotnet run

Backend runs at:

http://localhost:5133

🎨 Frontend Setup

Install & Run

cd frontend

npm install
npm run dev

Frontend runs at:

http://localhost:5173

Dev Proxy Routing

During development:

  • /api
  • /s
  • /storage

β†’ forwarded to backend:

http://localhost:5133

πŸ”‘ Main API Endpoints

Authentication

  • POST /api/auth/login

Admin Management

  • POST /api/admin/create-user
  • POST /api/admin/create-admin
  • GET /api/admin/list-users

Folder Management

  • POST /api/folders
  • GET /api/folders/{id}

File Management

  • POST /api/files/upload?folderId=X
  • GET /api/files/view/{fileId}
  • GET /api/files/download/{fileId}

File Sharing

  • POST /api/share/{fileId}
  • GET /s/{token}

βœ… Health Check Module

PeakDrive provides built-in diagnostics:

  • GET /health (lightweight)
  • GET /health/full (API + DB + Storage)

Example:

curl -i http://localhost:5133/health/full

πŸ“¦ Build Frontend (Production)

cd frontend
npm run build

Output:

frontend/dist/

πŸš€ Deployment Overview

Recommended production routing (Nginx):

  • /api β†’ backend service
  • /storage β†’ backend static serving
  • / β†’ React frontend build

πŸ“œ License

This project is licensed under the MIT License
Maintained by DitDev

See LICENSE for details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published