A full-stack photo storage and sharing application built using React, Node.js, MySQL, and styled with Tailwind CSS. Photopia allows users to securely upload, store, and share their photos with a clean and modern user interface.
Rehan Feroz Sayyed
- User authentication (Login/Registration).
- Secure JWT authentication.
- Upload photos to the platform.
- Simple, responsive UI built with Tailwind CSS.
- Dark mode for enhanced user experience.
Photopia/
β
βββ user-backend/ # Backend code
β βββ config/ # Database configuration
β β βββ db.js # MySQL database setup
β βββ controllers/ # Backend logic for authentication and file uploads
β β βββ fileController.js # Logic for handling file uploads
β βββ models/ # Models for user data and file storage
β β βββ User.js # User model for authentication
β βββ routes/ # API routes for user management and file uploads
β β βββ fileRoutes.js # Routes for file upload functionality
β β βββ jwtMiddleware.js # Middleware to protect routes with JWT authentication
β β βββ login.js # Login route
β β βββ register.js # Registration route
β β βββ User.js # User API routes
β βββ index.js # Entry point for the backend
β βββ package.json # Backend dependencies and scripts
β βββ .env # Environment variables for the backend
β βββ database_setup.sql # SQL Queries for the Database
β
βββ user-frontend/ # Frontend code
β βββ src/ # React source code
β β βββ components/ # React components (Navbar, Footer, FileUpload, etc.)
β β βββ pages/ # Pages for Home, Login, Register, etc.
β β βββ utils/ # Helper functions (API calls)
β β βββ main.jsx # React entry point
β β βββ App.jsx # Main application component
β β βββ index.css # Global styles
β βββ tailwind.config.js # Tailwind CSS configuration
β βββ package.json # Frontend dependencies and scripts
β βββ vite.config.js # Vite configuration
β βββ .env # Environment variables for the frontend
β βββ index.html # HTML template for the frontend
β
βββ README.md # Documentation for the project
βββ LICENSE # License file
Follow these steps to run the project locally:
To set up the database for the project, you can run the provided SQL script. This will create the necessary tables (users
and user_files
) for the application.
- Download the database_setup.sql file from the repository.
- Connect to your MySQL database.
- Run the following commands in your MySQL client:
-- Create the database
CREATE DATABASE user_auth_system;
-- Use the database
USE user_auth_system;
-- Create the users table
CREATE TABLE users (
id INT AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(255) NOT NULL,
email VARCHAR(255) NOT NULL UNIQUE,
password VARCHAR(255) NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
-- Create the user_files table
CREATE TABLE user_files (
id INT AUTO_INCREMENT PRIMARY KEY,
user_id INT NOT NULL,
file_path VARCHAR(255) NOT NULL,
uploaded_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
);
- After running the above SQL commands, your database schema will be set up and ready to use with the application.
-
Navigate to the
user-backend/
directory:cd user-backend
-
Install dependencies:
npm install
-
Create a
.env
file in theuser-backend/
directory and add:JWT_SECRET = your-secret-jwt-token DB_HOST= your-localhost (e.g., localhost) DB_USER= your-database-user (e.g., root) DB_PASSWORD= your-database-password DB_NAME= your-database-name
-
Start the backend server:
npm start
-
Navigate to the
user-frontend/
directory:cd user-frontend
-
Install dependencies:
npm install
-
Create a
.env
file in theuser-frontend/
directory and add:VITE_API_URL='http://localhost:5000'
-
Start the frontend development server:
npm run dev
- React
- Tailwind CSS
- Vite
- Axios
- Node.js
- Express.js
- MySQL (using Sequelize ORM)
- JWT (JSON Web Tokens for authentication)
- Start the backend server (refer to Setup > Backend).
- Start the frontend server (refer to Setup > Frontend).
- Open http://localhost:5173 in your browser to access the app.
For testing, offline usage, you can use the following credentials:
- Email:
[email protected]
- Password:
1234
Method | Endpoint | Description |
---|---|---|
POST | /login |
Login a user and return a JWT token |
POST | /register |
Register a new user |
POST | /change-password |
Change Password of the user |
POST | /upload |
Upload a photo |
GET | /files |
Get the files of the logged-in user |
Minimalistic and user-friendly login page.
Easy registration form to create a new account.
A minimalistic UI to upload, store, and manage your photos.
The application is hosted on Vercel (Frontend). However, the backend is not hosted. To access the application, use the following default credentials:
- Email:
[email protected]
- Password:
1234
You can view the application here.
If you want to contribute to this project, follow these steps:
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch
). - Make your changes and commit (
git commit -am 'Add new feature'
). - Push to the branch (
git push origin feature-branch
). - Create a new Pull Request.
This project is licensed under the MIT License. See the LICENSE file for details.
For any questions or issues, please reach out to:
- Email: [email protected]
- GitHub: Rehan Sayyed