A modern, secure file-sharing application built with React, Firebase, and Vite.A modern, production-ready template for building full-stack React applications using React Router.
-
User Authentication: Secure sign-up and login with Firebase Authentication## Features
-
File Upload: Upload files up to 50MB to Firebase Storage
-
File Management: View, download, and delete your uploaded files- π Server-side rendering
-
Real-time Updates: See your files update in real-time with Firestore- β‘οΈ Hot Module Replacement (HMR)
-
Responsive Design: Works seamlessly on desktop and mobile devices- π¦ Asset bundling and optimization
-
Secure: Files are protected with Firebase Security Rules - users can only access their own files- π Data loading and mutations
-
π TypeScript by default
- π React Router docs
Before you begin, ensure you have:
-
Node.js (v14 or higher) installed## Getting Started
-
A Firebase account (free tier works great!)
-
npm or yarn package manager### Installation
-
Create a Firebase Project```bash
-
Go to Firebase Consolenpm install
-
Click "Add project" and follow the setup wizard```
-
Once created, click on the web icon (</>) to register your app
-
-
Enable Authentication
-
In Firebase Console, go to AuthenticationStart the development server with HMR:
-
Click "Get Started"
-
Enable "Email/Password" sign-in method```bash
-
npm run dev
-
Create Firestore Database```
-
Go to Firestore Database
-
Click "Create database"Your application will be available at
http://localhost:5173. -
Choose "Start in production mode" (we'll add security rules)
-
Select a location close to your users## Building for Production
-
-
Set up Firebase StorageCreate a production build:
-
Go to Storage
-
Click "Get Started"```bash
-
Choose "Start in production mode"npm run build
-
5. **Get Firebase Config**
- Go to Project Settings (gear icon)## Deployment
- Scroll down to "Your apps" section
- Copy the Firebase configuration object### Docker Deployment
6. **Update Firebase Config**To build and run using Docker:
- Open `src/firebase.js`
- Replace the placeholder config with your actual Firebase configuration:```bash
```javascriptdocker build -t my-app .
const firebaseConfig = {
apiKey: "your-api-key",# Run the container
authDomain: "your-auth-domain",docker run -p 3000:3000 my-app
projectId: "your-project-id",```
storageBucket: "your-storage-bucket",
messagingSenderId: "your-messaging-sender-id",The containerized application can be deployed to any platform that supports Docker, including:
appId: "your-app-id"
};- AWS ECS
```- Google Cloud Run
- Azure Container Apps
7. **Deploy Security Rules**- Digital Ocean App Platform
- In Firebase Console, go to Firestore Database > Rules- Fly.io
- Copy the Firestore rules from `firebase.rules` and paste them- Railway
- Go to Storage > Rules
- Copy the Storage rules from `firebase.rules` and paste them### DIY Deployment
- Publish the rules
If you're familiar with deploying Node applications, the built-in app server is production-ready.
## π» Installation & Running
Make sure to deploy the output of `npm run build`
1. **Navigate to project directory**
```bash```
cd file-share-appβββ package.json
```βββ package-lock.json (or pnpm-lock.yaml, or bun.lockb)
βββ build/
2. **Install dependencies** (if not already installed)β βββ client/ # Static assets
```bashβ βββ server/ # Server-side code
npm install```
-
Start the development server
npm run dev ```--- -
Open your browserBuilt with β€οΈ using React Router.
- The app should automatically open at
http://localhost:3000 - If not, manually navigate to the URL shown in the terminal
- The app should automatically open at
file-share-app/
βββ package.json # Project dependencies and scripts
βββ vite.config.js # Vite configuration
βββ index.html # HTML entry point
βββ firebase.rules # Firebase security rules
βββ src/
β βββ main.jsx # Application entry point
β βββ firebase.js # Firebase configuration
β βββ App.jsx # Main app component with routing
β βββ styles.css # Global styles
β βββ components/
β βββ Auth.jsx # Sign-in/Sign-up component
β βββ Upload.jsx # File upload component
β βββ FileList.jsx # File listing component
β βββ ProtectedRoute.jsx # Route protection wrapper
βββ public/
βββ favicon.ico # App icon
-
Sign Up/Sign In
- Create a new account with email and password
- Or sign in if you already have an account
-
Upload Files
- Click "Choose a file" or drag and drop
- Select a file (max 50MB)
- Click "Upload File"
- Watch the progress bar
-
Manage Files
- View all your uploaded files in a grid
- Click "Download" to save a file
- Click "Delete" to remove a file
- React - UI framework
- Vite - Build tool and dev server
- Firebase Authentication - User authentication
- Firebase Firestore - NoSQL database for metadata
- Firebase Storage - File storage
- React Router - Client-side routing
npm run dev- Start development servernpm run build- Build for productionnpm run preview- Preview production build locally
- All files are private by default
- Users can only access their own files
- Firebase Security Rules enforce access control
- Files are stored with user ID in the path
- Authentication required for all operations
This project is fully configured for Firebase Hosting. Follow these steps:
npm install -g firebase-toolsfirebase loginEdit .firebaserc and replace "your-project-id" with your actual Firebase project ID:
{
"projects": {
"default": "your-actual-project-id"
}
}npm run buildThis creates an optimized production build in the dist folder.
firebase deployThis will deploy:
- β Hosting: Your React app
- β Firestore Rules: Database security rules
- β Storage Rules: File storage security rules
- Deploy only hosting:
firebase deploy --only hosting - Deploy only rules:
firebase deploy --only firestore:rules,storage:rules
- Vercel: Connect your GitHub repo
- Netlify: Drag and drop the
distfolder
Authentication not working?
- Ensure Email/Password is enabled in Firebase Console
- Check your Firebase configuration in
src/firebase.js
Files not uploading?
- Verify Storage is set up in Firebase Console
- Check if file size is under 50MB
- Ensure security rules are properly deployed
Files not showing?
- Check Firestore security rules
- Verify you're signed in with the correct account
- Check browser console for errors
This project is open source and available under the MIT License.
Contributions are welcome! Feel free to submit issues or pull requests.
If you have any questions or need help, please open an issue on GitHub.
Made with β€οΈ using React and Firebase