Welcome to my first fullstack application built using the PERN stack! This application functions as a storage service similar to Google Drive but is focused exclusively on image.
- Features
- Testing the Deployment
- Technologies Used
- Installation
- Usage
- API Endpoints
- Error Handling
- License
Registered account for lazy ones:
- Email: [email protected]
- Password: 1e#uyjG%4
- Image Storage: Upload and store images.
- Folder Management: Create, read, update, and delete folders for organizing images.
- User Authentication: Secure user access using Passport.js for authentication.
- Cloudinary Integration: Utilize Cloudinary as a third-party service for image storage.
- Error Handling: Comprehensive error handling for various scenarios.
- Security Layers: The application employs security layers such as Helmet for HTTP header security, CORS with a whitelist for origin control, rate limiting to prevent abuse, XSS protection using
xss-clean
,and request compression for performance enhancement.
- Frontend: React.js
- Backend: Node.js, Express
- Database: PostgreSQL with Prisma ORM
- Authentication: Passport.js
- Image Storage: Cloudinary
To get started with this project, follow these steps:
- Clone the repository:
git clone https://github.com/mohyware/Personal-Storage-Service
cd Personal-Storage-Service
- Install the dependencies for both back-end and front-end: npm install
- Set up your environment variables in a .env file in the server directory:
- Run database migrations:
npx prisma migrate dev
- start back-end:
cd back-end
npm run start
- start front-end:
cd front-end
npm run start
Once the application is running, you can access its front end at http://localhost:3000. You can create an account, log in, and start uploading images to your storage space (notice that accessing back-end directly is forbidden with cors so u have to change it).
Here are some key API endpoints available in the application:
-
Authentication:
POST /api/v1/auth/register
- Register a new userPOST /api/v1/auth/login
- Log in a userGET /api/v1/auth/logout
- Log out the user
-
User Management:
PATCH /api/v1/user/:id
- Update user informationDELETE /api/v1/user/:id
- Delete a user accountGET /api/v1/user/:id
- Retrieve user data
-
Folder Management:
POST /api/v1/folder
- Create a new folderGET /api/v1/folder
- Retrieve all foldersPUT /api/v1/folder/:id
- Update a folderDELETE /api/v1/folder/:id
- Delete a folder
-
Image Management:
POST /api/v1/file/upload
- Upload a new image to CloudinaryGET /api/v1/file/download/:id
- Download an image from CloudinaryGET /api/v1/file
- Retrieve all imagesPATCH /api/v1/file/:id
- Update image detailsGET /api/v1/file/:id
- Retrieve a specific image by IDDELETE /api/v1/file/:id
- Delete an image
The application includes an error handler that captures and responds to various error scenarios, ensuring a smooth user experience and aiding in troubleshooting.
This project is licensed under the MIT License. See the LICENSE file for more details.