No description
| cmd/server | ||
| docs | ||
| internal | ||
| .dockerignore | ||
| .gitignore | ||
| AGENTS.md | ||
| docker-compose.yml | ||
| Dockerfile | ||
| go.mod | ||
| go.sum | ||
| PROJECT_SKELETON_PROMPT.md | ||
| README.md | ||
| USER_STORIES.md | ||
Scríobh
Scríobh is a minimal writing platform that mimics Write Freely. It features a set of themes, uses markdown for input, and is designed for simple writing needs.
Project Structure
Scríobh/
├── cmd/server/
│ ├── main.go # Entry point & HTTP server
│ ├── package.json # Frontend dependencies
│ ├── build.js # esbuild bundler configuration
│ ├── src/ # SolidJS source code
│ │ ├── index.jsx # Frontend entry point
│ │ └── App.jsx # Main App component
│ └── static/ # Build output + index.html
│ └── index.html # HTML template with bootstrap injection
├── internal/
│ ├── db/ # Database layer (SQLite + Migrations)
│ │ └── db.go
│ ├── models/ # Domain models
│ └── auth/ # Authentication logic
├── go.mod # Go dependencies
├── Dockerfile # Multi-stage build (Node -> Go -> Alpine)
├── docker-compose.yml # Local development & deployment
└── .dockerignore # Docker ignore rules
Requirements
- Go 1.23+ (for local development)
- Node.js 20+ (for building the frontend)
- Docker & Docker Compose (for containerized deployment)
Getting Started
Local Development
-
Install Frontend Dependencies:
cd cmd/server npm install -
Build the Frontend:
npm run buildOr use
npm run watchfor automatic rebuilding. -
Run the Backend:
go mod tidy go mod vendor go run cmd/server/main.go
Docker Deployment
To build and run the entire stack using Docker:
docker-compose up --build
The application will be available at http://localhost:8080.
Usage Guide
Writing Posts
- Register/Login: Create an account to start writing.
- Create a Blog: From the dashboard, create a new blog with a custom name and URL slug.
- New Post: Click "New Post" on your blog card.
- Editor:
- The editor is distraction-free and supports Markdown.
- YAML Frontmatter: Use
---at the top of your post to define metadata.--- title: My First Post description: A brief summary --- - Publish: Click "Publish" to save your post. It will be publicly accessible via your blog's URL.
Managing Content
- Dashboard: View all your blogs and create new ones.
- Edit/Delete: Navigate to your blog's public page while logged in to see "Edit" and "Delete" controls for your posts.
Discovery & Search
- Discovery: Visit
/discoveryto see all public blogs on the platform. - Search: Visit
/searchto search through public posts by title or content.
Technical Details
- Backend: Go with
chirouter andmodernc.org/sqlite(CGO-free). - Frontend: SolidJS bundled with
esbuild. - Markdown: Uses
markedfor rendering andjs-yamlfor frontmatter. - Data Injection: Server-side bootstrap data injection via
window.__BOOTSTRAP_DATA__. - Database: SQLite with a custom migration system in
internal/db/db.go. - Logging: Structured logging using Go's
slogpackage.
Engineering Principles
This project follows strict engineering principles to ensure it is production-ready and maintainable:
- Production-Ready Code: Idiomatic Go and JavaScript with comprehensive error handling.
- No External Dependencies at Runtime: No external API calls or internet-dependent services.
- Minimal Dependencies: Dependencies are kept to a minimum. Go modules should be vendored (
go mod vendor). - Documentation: Comprehensive inline documentation for all major components.
- Graceful Shutdown: Implements proper signal handling and context cancellation for clean exits.
- Structured Logging: Uses
slogfor consistent, machine-readable logs. - Security Best Practices: Includes input validation, prepared statements for SQL, and secure header management.
- Self-Contained: The frontend is embedded into the Go binary using
go:embed. - Testing: Unit tests are required for all core functionality to ensure reliability and prevent regressions.
- Testing: Unit tests are required for all core functionality to ensure reliability and prevent regressions.