How codemyst/pastemyst works
Project type and purpose
• This is a full-stack web application (“Pastemyst”), written in the D language, that provides a beautiful, multi-file pastebin with user accounts, encryption, history, tagging, and a REST API.
• It also ships a first-party CLI tool (“pastry-cli”) that interacts with the same REST API.
File structure
• Root contains Dockerfile, docker-compose, Makefile, config templates, Dub (DUB) manifest, submodules, CI workflows.
• “views/” contains server-side Diet templates (.dt) for dynamic HTML rendering (pages, components, API docs).
• “source/” implements the backend in D, organized into:
• pastemyst/web → HTTP routes & page controllers
• pastemyst/rest → REST API endpoints (v1)
• pastemyst/auth → OAuth services (GitHub, GitLab, sessions)
• pastemyst/paste, data, db → business logic and data‐access layer for pastes, users, zips, avatars
• util, conv, encoding, time → supporting utilities (ID gen, diffs, encoding, expirations)
• “data/” holds JSON reference data (languages, expiration options).
• “lib/” vendored native libraries (scrypt for Windows, linguist metadata).
• Configuration and environment defined via config-example.yml, environment variables, Docker.
README for additional insights
• Uses MongoDB as the primary datastore (two databases: production/test).
• Depends on libssl, libscrypt, diff & patch for history.
• Built/run via dmd + dub run, or with Docker Compose.
• OAuth integrations with GitHub and GitLab.
• Emphasizes a simple REST API (v1) plus full web interface.
Detail is key
• Docker container boundary, showing that everything from the HTTP server down to MongoDB client runs inside the container, while MongoDB itself may be external or in another container.
• Configuration inputs (config.yaml) feeding into the server at startup.