github-stats
:octocat: Generate dynamic, futuristic SVG cards displaying GitHub user statistics for your README files!
- 28
- TypeScript
- MIT
- 3 d ago
The maintainer has not written a description at the source.
Repo pphatdev/storage.stackdev.cloud, read from GitHub 9 h ago. pphatdev has not joined Take My Repo.
pphatdev/storage.stackdev.cloud is a public repo on GitHub by pphatdev. It declares no license on GitHub. Public does not mean open source: without a license, nobody is granted the right to reuse it. It is written mainly in EJS, has 5 stars and last changed on 2026-10-17. Nobody has reviewed it on Take My Repo yet, which says nothing about its quality. Read from GitHub on 2026-11-20.
In the maintainer's words. Shown from GitHub; Take My Repo does not keep a copy.
A high-performance CDN API service for image optimization, file management, and asset delivery built with Express.js and TypeScript.
CDN API is a production-ready content delivery network service that provides intelligent image optimization, secure file storage, and efficient asset management. Built with modern web technologies, it offers both a RESTful API and a web-based dashboard for managing your digital assets.
Before installing, ensure you have the following:
# Clone the repository git clone <repository-url> cd assets.stackdev.cloud # Install dependencies npm install # Configure environment cp env.json.example env.json # Edit env.json with your configuration # Initialize database npm run migrate:up # (Optional) Seed demo data npm run seed # Run in development mode npm run dev
git clone <repository-url> cd assets.stackdev.cloud npm install
Create your configuration file:
cp env.json.example env.json
Edit env.json with your settings (see Configuration section).
# Run database migrations npm run migrate:up # Check migration status npm run migrate:status # (Optional) Seed demo users npm run seed
# Build CSS (Tailwind) npm run build:css # Full production build npm run build
# Development (with hot reload) npm run dev # Production npm start
The server will be available at http://localhost:3000 (or your configured port).
env.json){
"app": {
"name": "CDN API",
"env": "development" // "development" or "production"
},
"port": 3000, // Server port
"directories": [
"./storage/**/**" // Storage directory pattern
],
"allow": {
"origins": [
// Allowed CORS origins
"http://localhost:3000",
"http://localhost:5173"
],
"patterns": [
// Regex patterns for origins
"^https?://.*\\.stackdev\\.cloud$"
]
},
"database": {
"dbPath": "src/data/app.db", // SQLite database path
"autoRunMigrations": true, // Run migrations on startup
"autoRunSeeds": false // Run seeds on startup
},
"auth": {
"jwtSecret": "your-super-secret-jwt-key-min-32-characters-long",
"jwtExpiresIn": "1h", // Access token expiration
"refreshTokenExpiresIn": "7d", // Refresh token expiration
"bcryptRounds": 12, // Password hashing rounds
"maxLoginAttempts": 5, // Failed login limit
"lockoutDuration": 15, // Account lockout minutes
"maxSessionsPerUser": 5 // Max concurrent sessions
}
}| Option | Type | Description | Default |
|---|---|---|---|
app.name |
string | Application name | "CDN API" |
app.env |
string | Environment mode | "development" |
port |
number | Server port | 3000 |
directories |
array | Storage directory patterns | ["./storage/**/**"] |
allow.origins |
array | Exact CORS origins | [] |
allow.patterns |
array | Regex patterns for CORS | [] |
database.dbPath |
string | SQLite database file path | "src/data/app.db" |
database.autoRunMigrations |
boolean | Auto-run migrations on startup | true |
database.autoRunSeeds |
boolean | Auto-run seeds on startup | false |
auth.jwtSecret |
string | JWT secret key (min 32 chars) | Required |
auth.jwtExpiresIn |
string | Access token TTL | "1h" |
auth.refreshTokenExpiresIn |
string | Refresh token TTL | "7d" |
auth.bcryptRounds |
number | Password hashing strength | 12 |
auth.maxLoginAttempts |
number | Failed login threshold | 5 |
auth.lockoutDuration |
number | Lockout duration (minutes) | 15 |
auth.maxSessionsPerUser |
number | Max concurrent sessions per user | 5 |
The default storage structure:
storage/
├── background/ # Background images
│ └── cover/ # Cover images
├── documents/ # Document uploads
├── example/ # Example assets
│ └── site.webmanifest
└── files/ # General file uploads
You can customize storage locations in env.json.
The application uses SQLite with Drizzle ORM for data persistence. The database file is stored at src/data/app.db.
The system includes the following tables:
# Check migration status npm run migrate:status # Run all pending migrations npm run migrate:up # Rollback last migration npm run migrate:down # Create a new migration npm run migrate:create "migration_name"
# Run all seed files npm run seed # Create a new seed file npm run seed:create "seed_name"
Launch the visual database browser:
npm run db:studio
Then visit http://localhost:4983/ to:
# Generate schema from TypeScript code npm run db:generate # Push schema changes directly to database npm run db:push
⚠️ Note: Use db:push for rapid development, but use migrations (migrate:up) for production environments.
To backup the database:
# Windows copy src\data\app.db src\data\app.db.backup # Linux/macOS cp src/data/app.db src/data/app.db.backup
Or use the API endpoint:
curl -X POST http://localhost:3000/api/database/backup
# Development mode (with hot reload and detailed logging) npm run dev # Production mode npm start # Watch CSS changes (separate terminal) npm run css
npm run db:studio and visit http://localhost:4983/After running migrations, a default admin account is created:
adminadmin123admin@stackdev.cloud⚠️ Important: Change the admin password immediately after first login!
curl -X POST http://localhost:3000/api/image/upload \
-F "images=@photo.jpg"curl -X POST http://localhost:3000/api/file/upload \ -F "files=@document.pdf" \ -F "path=/documents"
curl http://localhost:3000/api/storage
http://localhost:3000/api
The API supports JWT-based authentication. While many endpoints work without authentication, protected endpoints require a valid JWT token.
curl -X POST http://localhost:3000/api/auth/login \ -H "Content-Type: application/json" \ -d '{ "username": "admin", "password": "admin123" }'
Include the JWT token in the Authorization header:
curl http://localhost:3000/api/auth/me \
-H "Authorization: Bearer YOUR_JWT_TOKEN"/auth/logout to invalidate current session/auth/logout-all to invalidate all user sessions| Category | Endpoint | Method | Description | Auth Required |
|---|---|---|---|---|
| Health | / |
GET | API welcome message | No |
| Health | /version |
GET | Get API version info | No |
| Auth | /auth/login |
POST | User login (rate limited) | No |
| Auth | /auth/logout |
POST | Logout current session | Yes |
| Auth | /auth/logout-all |
POST | Logout all sessions | Yes |
| Auth | /auth/me |
GET | Get current user info | Yes |
| Auth | /auth/me/avatar |
POST | Upload user avatar | Yes |
| Images | /image/upload |
POST | Upload images (rate limited) | Optional |
| Images | /image/* |
GET | Retrieve optimized images | No |
| Files | /file/upload |
POST | Upload files (rate limited) | Optional |
| Files | /file/search |
GET | Search files by name | No |
| Files | /file/move |
PUT | Move files/folders | Optional |
| Files | /file/delete |
DELETE | Delete files | Optional |
| Files | /file/download/* |
GET | Download files | No |
| Files | /file/preview/* |
GET | Preview documents | No |
| Folders | /folder |
GET | Get folder structure | No |
| Database | /database/files |
GET | Get files database | No |
| Database | /database/stats |
GET | Database statistics | No |
| Database | /database/search |
GET | Search database | No |
| Database | /database/backup |
POST | Backup database | Optional |
| Users | /auth/users |
GET | List all users (Admin) | Yes |
| Users | /auth/users |
POST | Create new user (Admin) | Yes |
| Users | /auth/users/:id |
PUT | Update user (Admin) | Yes |
| Users | /auth/users/:id |
DELETE | Delete user (Admin) | Yes |
| Storage | /storage |
GET | Full storage statistics | No |
| Storage | /storage/summary |
GET | Quick storage summary | No |
For comprehensive API documentation with examples, see:
Import the Postman collection for testing:
docs/collections/collection.postman_collection.json
The application includes a full-featured web interface accessible via browser:
| Route | Description | Auth Required |
|---|---|---|
/ |
Dashboard overview with storage stats | Yes |
/login |
User authentication page | No |
/files |
File browser and manager | Yes |
/files/* |
Navigate through folder structure | Yes |
/starred |
Quick access to starred files | Yes |
/recent |
Recently accessed files | Yes |
/detail |
Detailed file information | Yes |
/share |
Shared files management | Yes |
/upload |
File upload interface | Yes |
/upload/history |
Upload activity history | Yes |
/users |
User management (Admin only) | Yes |
Note: Web authentication is handled via JWT tokens stored in browser cookies. Users are automatically redirected to /login if not authenticated.
# Development server with hot reload npm run dev # Watch CSS changes (Tailwind) npm run css # Build CSS for production npm run build:css # Build TypeScript npm run build # Production server npm start
# Run all pending migrations npm run migrate:up # Rollback last migration npm run migrate:down # Check migration status npm run migrate:status # Create new migration npm run migrate:create "migration name" # Run database seeds npm run seed # Create new seed file npm run seed:create "seed name" # Generate Drizzle schema npm run db:generate # Push schema changes npm run db:push # Open Drizzle Studio npm run db:studio
src/npm run css in separate terminal for Tailwindnpm run build before deployment.js extensionssrc/server/routes/src/server/controllers/src/server/utils/src/server/routes/api.tsdocs/how-to-use/cdn.api.pphat.stackdev.cloud/
├── src/
│ ├── app.ts # Application entry point
│ ├── client/ # Frontend application
│ │ ├── controller/ # Client controllers
│ │ ├── middlewares/ # Client middlewares
│ │ │ └── auth.ts # Client auth middleware
│ │ ├── routes/ # Client routes
│ │ │ └── web.ts # Web routes
│ │ ├── styles/ # CSS/Tailwind styles
│ │ ├── utils/ # Client utilities
│ │ └── views/ # EJS templates
│ │ ├── components/ # Reusable components
│ │ ├── layouts/ # Layout templates
│ │ └── pages/ # Page templates
│ ├── data/ # Data storage
│ │ ├── app.db # SQLite database
│ │ ├── database.json # Legacy JSON store
│ │ ├── migrations/ # Database migrations
│ │ │ ├── 0000_youthful_ozymandias.sql
│ │ │ ├── 20260213_000000_create_initial_auth_tables_sqlite.ts
│ │ │ ├── 20260214_000000_create_files_uploads_tables_sqlite.ts
│ │ │ ├── meta/ # Drizzle metadata
│ │ │ └── README.md
│ │ ├── schema/ # Database schemas
│ │ │ └── schema.ts # Drizzle ORM schema
│ │ └── seeds/ # Database seeds
│ │ └── 20260213_010000_demo_users_sqlite.ts
│ └── server/ # Backend API
│ ├── controllers/ # API controllers
│ │ ├── auth.controller.ts # Authentication controller
│ │ ├── files.controller.ts
│ │ ├── folder.controller.ts
│ │ ├── images.controller.ts
│ │ ├── preview.controller.ts
│ │ ├── session.controller.ts # Session management
│ │ ├── storage.controller.ts
│ │ ├── upload.controller.ts
│ │ └── users.controller.ts # User management
│ ├── middlewares/ # Express middlewares
│ │ ├── auth.ts # JWT auth middleware
│ │ ├── cors.ts
│ │ ├── rate-limit.ts
│ │ └── security.ts # Security headers
│ ├── routes/ # API routes
│ │ ├── api.ts # Main API router
│ │ ├── auth.ts # Auth routes
│ │ ├── database.ts
│ │ ├── file.ts
│ │ ├── folder.ts
│ │ ├── image.ts
│ │ └── storage.ts
│ ├── types/ # TypeScript types
│ │ └── user.ts # User & auth types
│ └── utils/ # Server utilities
│ ├── auth.ts # Auth utilities
│ ├── config.ts # Configuration loader
│ ├── database.ts # Database operations (legacy)
│ ├── db.ts # Drizzle DB client
│ ├── directories.ts # Directory utilities
│ ├── files.ts # File operations
│ ├── image-cache.ts # Image caching
│ ├── migration-runner.ts # Migration system
│ ├── mine-types.ts # MIME type detection
│ ├── response.ts # Response helpers
│ └── storage.ts # Storage statistics
├── storage/ # File storage directory
│ ├── background/ # Background images
│ │ └── cover/ # Cover images
│ ├── documents/ # Document files
│ ├── example/ # Example assets
│ └── files/ # General file uploads
├── docs/ # Documentation
│ ├── collections/ # Postman collections
│ │ └── collection.postman_collection.json
│ └── how-to-use/ # Endpoint documentation
├── scripts/ # Build and utility scripts
│ ├── migrate.ts # Migration CLI
│ └── register.mjs # TS-Node registration
├── dist/ # Compiled output (gitignored)
├── drizzle.config.ts # Drizzle ORM config
├── env.json # Configuration (gitignored)
├── env.json.example # Configuration template
├── package.json # Dependencies
├── tsconfig.json # TypeScript config
├── postcss.config.js # PostCSS config
├── Dockerfile # Docker configuration
└── README.md # This file
# Install dependencies npm ci --production=false # Build application npm run build # Start production server npm start
# Build Docker image docker build -t cdn-api . # Run container docker run -d \ -p 3000:3000 \ -v $(pwd)/storage:/app/storage \ -v $(pwd)/env.json:/app/env.json \ --name cdn-api \ cdn-api
# Install PM2 npm install -g pm2 # Start with PM2 pm2 start dist/app.js --name cdn-api # Enable startup script pm2 startup pm2 save # Monitor pm2 monit
server { listen 80; server_name cdn.yourdomain.com; location / { proxy_pass http://localhost:3000; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; } }
For production, consider using environment variables instead of env.json:
export NODE_ENV=production export PORT=3000 export APP_NAME="CDN API"
Use the provided Postman collection:
# Import collection
docs/collections/collection.postman_collection.json# Install Apache Bench apt-get install apache2-utils # Linux brew install httpd # macOS # Test image endpoint ab -n 1000 -c 10 http://localhost:3000/api/storage/summary # Test upload rate limiting ab -n 50 -c 5 -p file.jpg -T multipart/form-data \ http://localhost:3000/api/image/upload
Contributions are welcome! Please follow these guidelines:
git checkout -b feature/amazing-feature)git commit -m 'Add amazing feature')git push origin feature/amazing-feature)type(scope): subject
body
footer
Types: feat, fix, docs, style, refactor, test, chore
Example:
feat(storage): add file type filtering to storage stats
Added optional query parameter to filter storage statistics by file type.
This allows users to get specific analytics for images, documents, etc.
Closes #123
This project is licensed under the ISC License - see the LICENSE file for details.
Sophat (PPhat)
If you encounter any issues or have questions:
Made with ❤️ by pphatdev
pphatdev/storage.stackdev.cloud is a public repo on GitHub by pphatdev. Its maker has not written a description.
It declares no license on GitHub. Public does not mean open source: without a license, nobody is granted the right to reuse it.
Its maker has not tagged a system, so it is unknown here. Its README says what it needs.
Open "Take it" on its page: Take My Repo writes an install plan for your machine and hands it to your AI agent (Claude Code, Codex or Cursor), which asks you before each step. Take My Repo has not tested it on any machine.
Its last change on GitHub was on 2026-10-17. Take My Repo does not judge from that whether it is maintained.
:octocat: Generate dynamic, futuristic SVG cards displaying GitHub user statistics for your README files!
Nobody has reviewed it on Take My Repo yet, which says nothing about its quality.
Sample Project Node Module APIs connecting with Postgres SQL
This page is also available as structured data, with the same sources and dates.
/api/v1/resources/gh/pphatdev/storage.stackdev.cloudTake My Repo has not tested this on your machine. Requirements come from the project's own documentation.