A simple, self-hosted download server with a secure administration dashboard for managing file mirrors.
JADS (Just A Download Server) is a straightforward, self-hosted solution designed for managing file mirrors and serving downloads. It provides a clean, secure backend dashboard for administrators to upload and manage files, without exposing a public-facing upload interface. This project is ideal for individuals or organizations needing a dedicated, easy-to-deploy server to host files for download, with a focus on simplicity and control.
- π― Secure File Uploads: Administrators can securely upload files via a dedicated dashboard.
- β¬οΈ Public File Downloads: Serve hosted files to users for direct download.
- π Admin Dashboard: A user-friendly web interface for managing uploaded files.
- π Administrator Authentication: Secure login system to protect the dashboard and upload functionalities.
- πΎ SQLite Database: Lightweight and easy-to-set-up database for storing file metadata and user information.
- β‘ Lightweight & Efficient: Built with Node.js and Express.js for fast performance.
- EJS (Embedded JavaScript Templating)
- Multer (for file uploads)
bcrypt(for password hashing)dotenv(for environment variables)express-session(for session management)
Before you begin, ensure you have the following installed:
- Node.js (v18.x or higher recommended)
- npm (Node Package Manager, usually comes with Node.js)
-
Clone the repository
git clone https://github.com/ademmoe/jads.git cd jads -
Install dependencies
npm install
-
Database setup The application uses SQLite, which is file-based. The database file (
database.sqlite) will be automatically created in the root directory on the first run. -
Start server
node index.js
-
Open your browser
- Admin Dashboard: Visit
http://localhost:[YOUR_PORT]/dashboard(e.g.,http://localhost:3000/dashboard) - Public Download Page: Visit
http://localhost:[YOUR_PORT]/(e.g.,http://localhost:3000/)
- Admin Dashboard: Visit
-
Run the setup Visit the Admin Dashboard. There, you will find the initial setup screen. Specify the domain name (possibly with the port) and create the initial admin user. After that, the configuration is completed and you can use JADS.
jads/
βββ .gitignore # Specifies intentionally untracked files to ignore
βββ LICENSE # Project license (MIT)
βββ database.js # Handles SQLite database connection and operations
βββ index.js # Main application entry point, server setup, routes, and logic
βββ package-lock.json # Records the exact dependency tree
βββ package.json # Project metadata and dependencies
βββ uploads/ # Directory where all uploaded files are stored
βββ views/ # Contains EJS template files for rendering the UI
βββ dashboard.ejs # Admin dashboard template
βββ layout.ejs # Base layout for EJS views
βββ login.ejs # Login page template
βββ index.ejs # Public download page templateJADS provides a quick-start setup where the configuration occurs manually.
| Command | Description |
|---|---|
npm start |
Starts the Node.js application server. |
The npm start command essentially runs node index.js.
Simply run npm start to get the server up and running. Any changes to index.js, database.js, or views/*.ejs will require a server restart to take effect. For continuous development, consider using nodemon.
This project does not include a dedicated testing suite or framework. Testing is primarily manual by interacting with the application via browser.
To deploy JADS to a production environment:
- Build (if any): This project does not require a specific build step; it runs directly with Node.js.
- Run: Use a process manager like PM2 or Systemd to keep the
npm startprocess running in the background and to handle restarts.# Example using PM2 (install globally: npm install -g pm2) pm2 start index.js --name jads pm2 save - Persistent Storage: Ensure the
uploads/directory anddatabase.sqlitefile are persisted across deployments or server restarts. - Reverse Proxy: For production, it is highly recommended to use a reverse proxy like Nginx or Apache in front of
jadsfor SSL termination, load balancing, and static file serving.
JADS provides a simple set of routes for its functionality.
The admin dashboard and upload functionality are protected by a session-based authentication system. Login is required to access /dashboard and /upload endpoints.
| Method | Endpoint | Description | Protected |
|---|---|---|---|
GET |
/ |
Displays the public download page | No |
GET |
/login |
Displays the admin login page | YES |
POST |
/login |
Authenticates an admin user | YES |
GET |
/dashboard |
Displays the admin dashboard (file list) | Yes |
POST |
/upload |
Handles file uploads to the server | Yes |
GET |
/files/:filename |
Serves a specific file for download | No |
POST |
/logout |
Logs out the current admin session | Yes |
POST |
/api/delete/:filename |
Deletes a specific file from the server | Yes |
We welcome contributions to JADS! If you'd like to contribute, please follow these steps:
- Fork the repository.
- Create a new branch (
git checkout -b feature/your-feature-name). - Make your changes.
- Commit your changes (
git commit -m 'feat: Add new feature'). - Push to the branch (
git push origin feature/your-feature-name). - Open a Pull Request.
The development setup is identical to the "Quick Start" guide. Ensure your .env file is properly configured.
This project is licensed under the MIT License - see the LICENSE file for details.
- Node.js: For providing a powerful JavaScript runtime.
- Express.js: For making web application development in Node.js simple and robust.
- EJS: For elegant templating.
- Multer: For simplifying file uploads.
- SQLite: For a lightweight and serverless database solution.
bcrypt: For secure password hashing.dotenv: For managing environment variables.express-session: For session management.
- π Issues: Feel free to report bugs or suggest features on GitHub Issues.
β Star this repo if you find it helpful!
Made with β€οΈ by Adem KaragΓΆz