This project is a work-in-progress.
Before setting up the project, ensure you have the following dependencies installed:
- Node.js & npm
- Go compiler (v1.25+ recommended)
- FFmpeg (for thumbnail generation)
- PostgreSQL
Additionally, you must create a PostgreSQL database for the server to save persistent data (it is recommended to name it Boxed).
To clone and run this project locally, follow the steps below:
-
Clone this repository:
git clone https://github.com/David/Boxed.git cd Boxed -
Build the project:
make build
Note: If a
.envfile is not found, the build process will automatically run the interactive environment setup tool (envcli). -
Run the project:
make run
These variables are required for the application to function. They are automatically managed by make and envcli, but can be edited manually in the .env file:
| Variable | Description | Example |
|---|---|---|
DB_URL |
PostgreSQL connection string | postgresql://user:pass@localhost:5432/Boxed |
BACKEND_PORT |
Port the server will listen on | 8080 |
FOLDER_PATH |
Directory where files will be stored | /home/user/uploads |
JWT_SECRET |
Secret key for signing tokens | your-super-secret-key |
.
├── cmd/
│ ├── api/ # Main API server entry point
│ └── cli/ # CLI utilities (envcli)
├── internal/
│ ├── auth/ # Authentication logic (JWT, Controllers, Services)
│ ├── files/ # File management logic (Upload, Serve, Thumbnails)
│ ├── common/ # Shared types and utilities
│ └── router.go # Route definitions
├── migrations/ # SQL migration files
├── repositories/ # Database access layer
├── assets/ # Images and static assets for README
└── Makefile # Automation commands
All routes under /api require a valid JWT in the Authorization header (Bearer <token>).
| Method | Route | Description | Required Input |
|---|---|---|---|
GET |
/auth/login |
Authenticate user | JSON: email, password |
GET |
/auth/register |
Register new user | JSON: nickname, email, password |
GET |
/auth/refresh |
Refresh JWT token | Header: refresh-token |
| Method | Route | Description | Required Input |
|---|---|---|---|
POST |
/api/upload-file |
Upload a single file | Multipart field: file |
POST |
/api/upload-files |
Upload multiple files | Multipart field: files |
GET |
/api/get-file |
Get file metadata | Header: uuid |
GET |
/api/get-files |
List all user files | None |
GET |
/api/serve-file |
Download file content | Header: uuid |
GET |
/api/serve-thumbnail |
Get file thumbnail | Header: uuid |
DELETE |
/api/delete-file |
Delete a file | Header: uuid |
curl -X GET http://localhost:8080/auth/register \
-H "Content-Type: application/json" \
-d '{"nickname": "user1", "email": "[email protected]", "password": "password123"}'curl -X GET http://localhost:8080/auth/login \
-H "Content-Type: application/json" \
-d '{"email": "[email protected]", "password": "password123"}'Response will include a JWT. Use this token for subsequent requests.
curl -X POST http://localhost:8080/api/upload-file \
-H "Authorization: Bearer <your-jwt-token>" \
-F "file=@/path/to/your/file.txt"This project uses a LICENSE file. Please check the details before using the code.
-
ThumbnailsEnhance file metadata retrieval to include thumbnail IDs for compatible file types (e.g., videos, images) when accessed through relevant API endpoints. -
Frontend While this project is primarily a backend service, creating a default frontend would be valuable, similar to how the
Jellyfinproject operates. This would provide an out-of-the-box user interface for managing files. Additionally, with the API documentation, developers should find it straightforward to create custom frontends that consume these endpoints. -
RefactorImprove the current project structure to be more intuitive and inviting for contributors. -
Standardize API responsesDefine a consistent response format across the repository (e.g. success, error, metadata) to improve predictability.Mostly done, just have to documentate errors. -
Create a CLI (Coommand line interface) tool for.envmanagementBuild a CLI utility to initialize and update.envfiles without manual editing. -
Add a Makefile for easier server setupProvide common commands (build, run, test, etc) to facilitate startup.
