This is a file-sharing platform backend built using Go, Gin framework, and JWT authentication.
- User authentication (Register/Login)
- JWT-based authentication middleware
- File upload and download
- User management
- Secure password hashing with bcrypt
- Go (Golang)
- Gin (Web framework)
- JWT (Authentication)
- bcrypt (Password hashing)
- PostgreSQL (Database)
- Clone the repository:
git clone https://github.com/your-username/your-repo.git
- Navigate to the project folder:
cd file-sharing-platform - Install dependencies:
go mod tidy
- Set up environment variables:
- Create a
.envfile and configure database and JWT secret.
DATABASE_URL=your_database_url JWT_SECRET=your_secret_key
- Create a
go run cmd/main.go| Method | Endpoint | Description |
|---|---|---|
| POST | /api/register |
Register new user |
| POST | /api/login |
Login user |
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/upload |
Upload a file |
| GET | /api/download |
Download a file |
file-sharing-platform/
├── cmd/
│ ├── main.go
├── internal/
│ ├── api/
│ │ ├── auth_handler.go
│ ├── db/
│ │ ├── database.go
│ ├── models/
│ │ ├── model.go
│ ├── auth/
│ │ ├── jwt.go
│ ├── middleware/
│ │ ├── middleware.go
├── go.mod
├── go.sum
└── README.md
Feel free to fork and contribute by submitting a pull request.
This project is licensed under the MIT License.