Sign inSign up

sudohash/cdn

By sudohash

•Updated 3 months ago

Image
0

6.1K

sudohash/cdn repository overview

⁠CDN Manager

A Node.js-based web application for managing and serving static files across multiple categories (CSS, JS, images, videos, documents, fonts, etc.) with a modern UI powered by Semantic UI and DataTables.

⁠Features

  • Upload, preview, and manage files in various categories
  • Secure authentication (JWT, session, or certificate-based)
  • RESTful API endpoints for categories and files
  • Embed code generation for easy integration
  • Logging with daily rotation
  • Docker support for easy deployment
  • Semantic UI-based responsive frontend

⁠Folder Structure

├── app.js                      # Main Express app
├── src/
│   ├── routes/                 # Express route handlers
│   ├── utils/                  # Utility modules (logger, storage, auth)
│   ├── static/                 # Frontend assets (Semantic UI, JS, CSS)
│   ├── views/                  # EJS templates
│   └── ...                     # Other backend folders
├── data/                       # Uploaded files (organized by category)
├── logs/                       # Application logs
├── __tests__/                  # Unit and integration tests
├── Dockerfile                  # Docker build instructions
├── docker-compose.yml          # Docker Compose config
├── package.json                # NPM dependencies and scripts
├── .env.example                # Environment variable template

⁠Getting Started

⁠Prerequisites
  • Node.js 20+
  • MongoDB (for session storage)
  • Docker (optional)
⁠Installation
  1. Clone the repository.

  2. Copy .env.example to .env and configure environment variables.

  3. Install dependencies:

    npm install
    
  4. Start MongoDB if not using Docker.

⁠Running Locally
node app.js

Visit http://localhost:3000⁠ in your browser.

⁠Docker

Build and run with Docker:

docker build -t cdn .
docker run -p 3000:3000 -v $(pwd)/data:/usr/src/app/data -v $(pwd)/logs:/usr/src/app/logs cdn

Or use Docker Compose:

docker-compose up

⁠API Endpoints

  • GET /api/categories — List available categories
  • GET /api/files?category=<name> — List files in a category (DataTables format)
  • POST /upload — Upload files
  • POST /login / POST /logout — Authentication

⁠Testing

Run unit tests:

npm test

⁠License

This project is licensed under the Apache License 2.0. See LICENSE⁠ for details.

Semantic UI assets are licensed under the MIT License. See src/static/semantic-ui-css/LICENSE⁠.

⁠Credits

Tag summary

Content type

Image

Digest

sha256:68eadc6b3…

Size

78.8 MB

Last updated

3 months ago

docker pull sudohash/cdn