How thesynthax/dropifi works
1. This repo is split into two Node/TypeScript codebases: server/ is the current implementation of Dropifi v2, and dropifi-v1/ is a separate legacy snapshot of the earlier version. For an architecture diagram, treat server/ as the active system and dropifi-v1/ as historical context.
2. The active service is a backend file-sharing system. The main runtime entrypoint is server/src/server.ts, which boots the HTTP server and wires together the rest of the application. There is no frontend in this repository.
3. Configuration is centralized under server/config/config.json, with the service code reading that config during startup. The config likely controls storage backend selection, Redis usage, cleanup behavior, and other deployment-specific settings.
4. The application is organized around a small set of business services in server/src/services/: validation, password handling, rate limiting, expiry logic, and cleanup orchestration. These are the main domain boundaries and are the right boxes to place in the middle of an architecture diagram.
5. File content storage is abstracted behind server/src/storage/. storage.interface.ts defines the contract, local-disk.ts and s3-storage.ts provide the concrete implementations, and factory.ts chooses between them. This is the key persistence boundary for the actual file bytes.
6. Metadata or application state is separated from blob storage through server/src/db/index.ts. That suggests a distinct database layer for records such as file info, expiry timestamps, or access-related state, while large file payloads go to disk or S3.
7. Redis is used as a supporting infrastructure component through server/src/lib/redis.ts. Combined with services/rate-limit.ts, it likely backs request throttling and other short-lived coordination/state needed by the API.
8. Cleanup is handled as its own flow rather than being embedded in request handling. server/src/queues/cleanup.ts and server/src/services/cleanup.ts indicate asynchronous deletion or retirement of expired files, with services/expiry.ts deciding when records become eligible for cleanup.
9. The end-to-end data flow is: incoming request → validation and rate limiting → optional password checks → metadata persistence in the DB layer → file write to the selected storage backend → later expiry/cleanup job → deletion from storage and database. That separation is the core architectural pattern in this repo.
10. The design supports multiple deployment modes. Local disk storage is present for development or simple setups, while S3 storage and Redis imply production-oriented external dependencies.
11. Testing is narrow and focused in this snapshot. server/tests/password.test.ts covers the password service, and the generated JS/typings are checked in alongside the TypeScript test source.
12. The dropifi-v1/ directory mirrors an older, simpler shape with its own server.ts and cleanup.ts. It appears to represent the previous generation of the same service and should not be diagrammed as a runtime dependency of v2.
Main entry points: server.ts Server · cleanup.ts Cleanup · factory.ts Storage factory · index.ts Database
Components 15
Dropifi v2
Current backend file-sharing system in server/
- Server · Boots HTTP server and wires the application
server/src/server.ts - Config · Central deployment configuration
server/config/config.json - Validation · Validates incoming requests and payloads
server/src/services/validation.ts - Rate limit · Controls request volume and short-lived abuse protection
server/src/services/rate-limit.ts - Password · Handles password protection and verification
server/src/services/password.ts - Expiry · Determines when files become eligible for retirement
server/src/services/expiry.ts - Cleanup · Coordinates deletion of expired files and records
server/src/services/cleanup.ts - Cleanup queue · Runs deferred cleanup work
server/src/queues/cleanup.ts - Database · Persists file records and application state
server/src/db/index.ts - Redis · Supports throttling and short-lived coordination
server/src/lib/redis.ts - Storage factory · Chooses the active blob storage implementation
server/src/storage/factory.ts - Local disk · Local file storage for simple deployments
server/src/storage/local-disk.ts - S3 storage · Object storage backend for production deployments
server/src/storage/s3-storage.ts
Dropifi v1
Historical snapshot kept for context
- V1 server · Older server generation kept as historical context
dropifi-v1/src/server.ts - V1 cleanup · Earlier cleanup flow from the legacy snapshot
dropifi-v1/src/cleanup.ts
Connections 17
- Server → Config: loads · Reads startup configuration
- Server → Validation: uses · Validates requests before handling
- Server → Rate limit: uses · Applies request throttling
- Server → Password: uses · Checks protected uploads and access
- Server → Database: uses · Stores and reads file metadata
- Server → Storage factory: uses · Selects blob storage backend
- Server → Redis: uses · Relies on Redis-backed coordination
- Server → Cleanup queue: starts · Wires asynchronous cleanup processing
- Rate limit → Redis: backed by · Uses Redis for throttling state
- Expiry → Cleanup: triggers · Marks records eligible for retirement
- Cleanup → Database: deletes · Removes expired metadata records
- Cleanup → Storage factory: deletes · Removes stored file content
- Cleanup queue → Cleanup: runs · Executes deferred cleanup jobs
- Storage factory → Local disk: selects · Local storage implementation
- Storage factory → S3 storage: selects · S3 storage implementation
- Password → Database: checks · May verify protected file state against metadata
- V1 server → V1 cleanup: paired with · Legacy runtime and cleanup flow