Skip to content

Rahul-Sahani04/FileStoragePSQL_Template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

File Storage Application with PostgreSQL

A full-stack application for uploading, storing, and managing files using React, Node.js, and PostgreSQL.

Features

  • File upload with drag-and-drop support
  • File listing with metadata (name, size, type, upload date)
  • File download functionality
  • Modern UI with Tailwind CSS
  • Real-time notifications
  • PostgreSQL for data persistence

Prerequisites

  • Node.js >= 14
  • PostgreSQL database server
  • Bun package manager

Setup

Database Setup

  1. Create a PostgreSQL database:
CREATE DATABASE file_upload_db;
  1. Update backend/.env with your database credentials if needed:
PGUSER=postgres
PGHOST=localhost
PGPASSWORD=your_password
PGDATABASE=file_upload_db
PGPORT=5432
PORT=5000

Backend Setup

  1. Install dependencies:
cd backend
bun install
  1. Start the server:
bun run dev

The server will start on http://localhost:5000

Frontend Setup

  1. Install dependencies:
cd frontend
bun install
  1. Start the development server:
bun run dev

The frontend will be available at http://localhost:5173

Usage

  1. Visit http://localhost:5173 in your browser
  2. Use the upload form to select and upload files
  3. View the list of uploaded files below
  4. Download files by clicking the download button

Architecture

Backend

  • Node.js with Express
  • PostgreSQL for database
  • Multer for file upload handling
  • RESTful API endpoints

Frontend

  • React with Vite
  • Tailwind CSS for styling
  • React Icons for icons
  • React Hot Toast for notifications

API Endpoints

  • POST /api/upload - Upload a file
  • GET /api/files - Get list of all files
  • GET /api/files/:id/download - Download a specific file

Directory Structure

.
├── backend/
│   ├── controllers/
│   ├── models/
│   ├── routes/
│   └── uploads/
└── frontend/
    ├── src/
    │   ├── components/
    │   └── assets/
    └── public/

About

A full-stack application for uploading, storing, and managing files using React, Node.js, and PostgreSQL.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors