Public Access
Version 0.1.0 #3
@@ -1,11 +1,13 @@
|
||||
# Draft
|
||||
|
||||
A powerful CLI tool for bootstrapping Go API projects with best practices built-in. Draft helps you quickly scaffold production-ready Go APIs with support for both HTTP (REST) and gRPC architectures.
|
||||
A powerful CLI tool for bootstrapping Go APIs, frontend clients, and full-stack monorepos with best practices built-in. Draft helps you quickly scaffold production-ready projects — a standalone Go API, a standalone Nuxt/Vue client, or both wired together in a single monorepo.
|
||||
|
||||
## Features
|
||||
|
||||
- 🚀 **Quick Project Scaffolding** - Generate complete API projects with a single command
|
||||
- 🚀 **Quick Project Scaffolding** - Generate complete projects with a single command
|
||||
- 🧩 **Three Project Shapes** - API only, client only, or a full-stack monorepo combining both
|
||||
- 🔄 **Multiple API Types** - Support for both HTTP (REST) and gRPC architectures
|
||||
- 🖼️ **Multiple Client Frameworks** - Nuxt or Vue, built on top of the official `nuxi`/`create-vue` tooling so the boilerplate always stays current
|
||||
- 📦 **Service Generation** - Easily create new services with proper structure
|
||||
- 🎯 **Handler Generation** - Generate HTTP or gRPC handlers on-demand
|
||||
- 🔐 **Cryptographic Key Generator** - Built-in secure key generation
|
||||
@@ -42,6 +44,14 @@ The compiled binary will be named `draft_<os>_<arch>` (e.g. `draft_darwin_arm64`
|
||||
|
||||
## Usage
|
||||
|
||||
### Create a New Project
|
||||
|
||||
```bash
|
||||
draft new
|
||||
```
|
||||
|
||||
Prompts you to pick a project shape — **API**, **Client**, or **Full Stack** (monorepo) — then runs the matching flow below. Each shape is also available directly as its own subcommand if you already know what you want.
|
||||
|
||||
### Create a New API Project
|
||||
|
||||
```bash
|
||||
@@ -64,6 +74,30 @@ This interactive command will:
|
||||
- `swag` - Swagger documentation (HTTP only)
|
||||
- `protoc-gen-*` - Protocol Buffer generators (gRPC only)
|
||||
|
||||
### Create a New Client Project
|
||||
|
||||
```bash
|
||||
draft new client
|
||||
```
|
||||
|
||||
1. Prompts for a project name
|
||||
2. Prompts you to pick a framework — **Nuxt** or **Vue**
|
||||
3. Scaffolds the base app via the official tooling (`nuxi init` for Nuxt, `create-vue` + `shadcn-vue` for Vue), so the generated boilerplate, dependency versions, and lockfile are always current rather than pinned by Draft
|
||||
4. Layers a Draft-maintained overlay on top: an auth store (login/logout/register/token refresh), route guards, API composable, and pages for login/signup/profile/organizations/email verification/invites — all wired up to talk to a Draft-generated API out of the box
|
||||
|
||||
Both frameworks produce a comparable app: Nuxt UI + Tailwind for Nuxt, shadcn-vue + Tailwind for Vue.
|
||||
|
||||
### Create a New Monorepo Project
|
||||
|
||||
```bash
|
||||
draft new monorepo
|
||||
```
|
||||
|
||||
Runs the API flow and the client flow together under one root, wired up as a single project:
|
||||
- `apps/api` — the scaffolded Go API
|
||||
- `apps/client` — the scaffolded Nuxt or Vue client
|
||||
- Root-level `go.work`, `pnpm-workspace.yaml`, `docker-compose.yml`, and `Justfile` tying both together
|
||||
|
||||
### Generate a New Service
|
||||
|
||||
```bash
|
||||
@@ -88,10 +122,11 @@ Creates a new handler in the appropriate directory:
|
||||
### Generate a Cryptographic Key
|
||||
|
||||
```bash
|
||||
draft new key
|
||||
draft key
|
||||
draft key --size 48
|
||||
```
|
||||
|
||||
Generates a secure random key for use in your application (default: 32 characters).
|
||||
Generates a secure random key for use in your application (default and minimum size: 32 characters). Passing `--size` below 32 is rejected rather than silently substituted.
|
||||
|
||||
### Check Version
|
||||
|
||||
@@ -101,7 +136,7 @@ draft version
|
||||
|
||||
## Project Structure
|
||||
|
||||
When you create a new project, Draft generates a structured Go API with:
|
||||
### API
|
||||
|
||||
```
|
||||
your-project/
|
||||
@@ -118,10 +153,38 @@ your-project/
|
||||
└── go.mod
|
||||
```
|
||||
|
||||
### Client
|
||||
|
||||
```
|
||||
your-client/
|
||||
├── app/ (Nuxt) or src/ (Vue)
|
||||
│ ├── stores/auth.ts
|
||||
│ ├── composables/useApi.ts
|
||||
│ ├── pages/ or views/
|
||||
│ └── ...
|
||||
├── nuxt.config.ts (Nuxt) or vite.config.ts + components.json (Vue)
|
||||
└── package.json
|
||||
```
|
||||
|
||||
### Monorepo
|
||||
|
||||
```
|
||||
your-project/
|
||||
├── apps/
|
||||
│ ├── api/ (Go API, its own go.mod)
|
||||
│ └── client/ (Nuxt or Vue client)
|
||||
├── go.work
|
||||
├── pnpm-workspace.yaml
|
||||
├── docker-compose.yml
|
||||
└── Justfile
|
||||
```
|
||||
|
||||
## Requirements
|
||||
|
||||
- Go 1.25.5 or higher
|
||||
- Make (for building from source)
|
||||
- `pnpm` and `npx` (Node.js) — required for client and monorepo scaffolding
|
||||
- `protoc` — required only for gRPC API projects
|
||||
|
||||
## Dependencies
|
||||
|
||||
@@ -143,6 +206,14 @@ make build
|
||||
make version
|
||||
```
|
||||
|
||||
### Sync Templates
|
||||
|
||||
Draft's embedded API/client templates are synced from a reference monorepo checked out as a git submodule (`assets/testdata/template`). After updating that submodule, regenerate the embedded copies with:
|
||||
|
||||
```bash
|
||||
go run tools/sync_templates.go
|
||||
```
|
||||
|
||||
## Contributing
|
||||
|
||||
Contributions are welcome! Please feel free to submit a Pull Request.
|
||||
|
||||
Reference in new issue
Block a user