LFS-App is a full-stack, secure file sharing platform that allows users to instantly upload files, generate unique secure sharing tokens, and distribute them for direct downloads. Supports quick guest uploads as well as registered user accounts with expanded storage limits.
- π Dual File-Sharing Flows:
- Guests: Share files instantly without an account.
- Registered Users: Create an account to unlock higher storage limits and track uploaded files.
- β‘ Dynamic Limit System: Configurable upload file size limits, maximum concurrent uploads, and total storage quotas per user type.
- βοΈ Hybrid Storage Providers: Supports both local file system storage (development) and Cloudinary cloud storage integration (production).
- π Token-Based Sharing: Secure, UUID-based file identification with direct token queries and one-click downloading.
- π Download Logging: Automatically records IP addresses and user agents for downloads to track file usage.
- π³ Dockerized Backend: Multi-stage production-ready Docker builds with dedicated spring non-root user execution.
- π Security Hardening: Secure CORS settings, Content Security Policy, frame options, and HSTS headers.
We have created comprehensive, in-depth documentation inside the /docs folder to help developers understand, maintain, and extend the LFS-App codebase.
Start with the LEARN_THIS_FIRST.md guide to understand the recommended study order and key concepts.
For a full index, refer to the main Documentation README.
- Project Architecture: High-level overview, design decisions, and technology stack.
- Frontend Flow: React SPA structure, global states, API integrations, and component hierarchies.
- Backend Flow: Spring Boot layer organization, request routing, and core service logics.
- Database Design: PostgreSQL schemas, tables, index definitions, and design patterns.
- Storage System: Cloudinary integration and local file system fallback mechanics.
- Authentication & Security: JWT lifecycles, guest session tokens, CORS rules, and secure practices.
- Deployment Guide: Setup guides for Vercel, Render, Supabase, and environment configurations.
- Feature Walkthroughs: Sequenced step-by-step lifecycles of major end-to-end user actions.
- Troubleshooting & Bug History: Confirmed bugs, root causes, fixes, and lessons learned.
- How to Modify this Project: Detailed recipes for developers looking to add database entities, endpoints, pages, or new storage systems.
ββββββββββββββββββββββββββ
β React Frontend β (Hosted on Vercel)
β (Single Page App) β
βββββββββββββ¬βββββββββββββ
β
β HTTPS + JWT Token
β (Cookie / Authorization Header)
βΌ
ββββββββββββββββββββββββββ
β Spring Boot REST API β (Hosted on Render - Docker Container)
β (Security & Limits) β
βββββββ¬βββββββββββββ¬ββββββ
β β
β SQL β Files (Multipart Upload)
βΌ βΌ
βββββββββββββββββ βββββββββββββββββββββββββββββ
β Supabase DB β β Storage: Local uploads/ β
β (PostgreSQL) β β or Cloudinary Bucket β
βββββββββββββββββ βββββββββββββββββββββββββββββ
The application supports a secure user login and registration system powered by JSON Web Tokens (JWT).
Because the frontend is hosted on Vercel (vercel.app) and the backend is on Render (onrender.com), browsers identify this as a cross-site connection and block cookies by default (due to strict SameSite/Secure browser policies).
To bypass this restriction seamlessly:
- Token Persistence: When a user logs in or registers, the frontend extracts the JWT token from the response body and saves it locally in
localStorageunderlfs_jwt_token. - Authorization Headers: All outgoing requests (checking sessions, limits, uploading, and downloading) automatically append the
Authorization: Bearer <token>header if present. - Session Validation: The backend's
JwtAuthenticationFiltervalidates this bearer header first, ensuring authentication succeeds even when cookies are entirely blocked.
- Node.js (v18 or higher) & NPM
- Java Development Kit (JDK 17) or Docker
Create a .env file inside both /frontend and /backend directories:
Frontend (/frontend/.env):
VITE_API_BASE_URL=http://localhost:8080/apiBackend (/backend/.env):
SPRING_DATASOURCE_URL=jdbc:postgresql://localhost:5432/lfs_app
SPRING_DATASOURCE_USERNAME=postgres
SPRING_DATASOURCE_PASSWORD=your_local_password
JWT_SECRET=LFS_APP_DEV_SECRET_CHANGE_BEFORE_PRODUCTION
APP_ENVIRONMENT=development
FRONTEND_URL=http://localhost:5173Start Backend:
cd backend
./mvnw spring-boot:runStart Frontend:
cd frontend
npm install
npm run devTo compile the Spring Boot app and run it inside a Docker container:
# Build the Docker image
docker build -t lfs-backend backend/
# Run the container (injecting environment variables)
docker run -p 8080:8080 --env-file backend/.env lfs-backend- Set up a new Web Service on Render and connect it to your GitHub Repository.
- Set the Root Directory to
backend. - Set the Environment/Runtime to
Docker(Render will automatically detect and build usingbackend/Dockerfile). - Configure the following environment variables in your Render Dashboard:
SPRING_DATASOURCE_URL= (Your PostgreSQL database URL, e.g. Supabase IPv4 Pooler URL)SPRING_DATASOURCE_USERNAME= (Database Username)SPRING_DATASOURCE_PASSWORD= (Database Password)JWT_SECRET= (Generate a secure 256-bit hex secret key)APP_ENVIRONMENT=productionFRONTEND_URL=https://your-vercel-frontend-domain.vercel.app
- Add a new project on Vercel and connect your Repository.
- Select Root Directory as
frontend. - Set the build framework to Vite (Vercel detects this by default).
- Configure Environment Variables:
VITE_API_BASE_URL=https://your-render-backend-url.onrender.com/api
- Vercel utilizes vercel.json to rewrite all routes to
/index.html, eliminating404 NOT_FOUNDerrors on page refresh.
- Environment-Driven Configuration: Moved database credentials, JWT secrets, and CORS domains out of the codebase and into secure environment variables.
- Dockerization: Created a secure, multi-stage production Docker configuration for the Spring Boot backend, running under a dedicated non-root user.
- Vercel Routing Rewrite: Added a
vercel.jsonrewrite rule to redirect all paths back to/index.html, eliminating the frustrating404 NOT_FOUNDerror on page refresh. - JWT Header Fallback: Implemented automatic
Authorization: Bearerheaders in the frontend API client. This bypasses the third-party cookie restrictions enforced by modern browsers in cross-domain environments. - Improved UX (URL Pasting): Added automated token extraction in the download page, allowing users to paste either the raw token or the full download URL.
- Clean Compiler Audits: Resolved java URL constructor deprecation warnings and cleaned up all unused imports and autowired repository references.
- π Password-Protected Downloads: Allow uploaders to secure files with custom passwords.
- β±οΈ Auto-Expiry Timers: Implement background tasks to automatically delete files after a selected period (e.g. 24 hours, 7 days).
- π Download Limits: Option to limit the number of times a file can be downloaded before expiring.
- π¦ AWS S3 / Cloud Storage Integration: Expand beyond local disk and Cloudinary to support direct streaming to Amazon S3 bucket storage.
- π User Dashboard & File Analytics: Provide account holders with simple charts tracking download activity, download counts, and total storage usage.
Ram Ambati
- GitHub: @Ram-ambati
- Engineering Student & Full-Stack Developer



