Production-ready monorepo starter with Google OAuth, JWT authentication, and waitlist functionality.
├── apps/
│ ├── api/ # Go backend
│ │ ├── cmd/api/ # Entry point
│ │ ├── internal/
│ │ │ ├── config/ # Environment config
│ │ │ ├── database/ # DB connection + sqlc
│ │ │ ├── domain/ # Business entities
│ │ │ ├── handler/ # HTTP handlers
│ │ │ ├── middleware/ # Auth, logging
│ │ │ ├── repository/ # Data access
│ │ │ ├── server/ # Router setup
│ │ │ └── service/ # Business logic
│ │ └── db/
│ │ ├── migrations/ # Goose migrations
│ │ └── queries/ # sqlc queries
│ │
│ └── web/ # SvelteKit frontend
│ └── src/
│ ├── lib/
│ │ ├── api/ # API client
│ │ └── types/ # TypeScript types
│ └── routes/
│ ├── app/ # Protected routes
│ ├── login/ # Auth pages
│ └── waitlist/
git clone https://github.com/yourusername/go-svelte-starter.git my-app
cd my-app
# Create database
createdb starter_dev
# Run migrations
cd apps/api
go install github.com/pressly/goose/v3/cmd/goose@latest
goose -dir db/migrations postgres "postgresql://localhost:5432/starter_dev" up
# Backend
cp apps/api/.env.example apps/api/.env
# Edit apps/api/.env with your values
# Frontend
cp apps/web/.env.example apps/web/.env
# Terminal 1: Backend
cd apps/api
go run cmd/api/main.go
# Terminal 2: Frontend
cd apps/web
pnpm install
pnpm dev
Visit http://localhost:5173
Frontend uses a proxy pattern - all API calls go through SvelteKit:
// In load functions
export const load = async ({ fetch }) => {
const api = createApi(fetch);
const { data: user } = await api.get<User>('/auth/me');
return { user };
};
Routes under /app/* require authentication:
// routes/app/+layout.server.ts
export const load = async ({ parent }) => {
const { user } = await parent();
if (!user) redirect(303, '/login');
return { user };
};
# Create migration
cd apps/api
goose -dir db/migrations create add_posts_table sql
-- db/queries/posts.sql
-- name: GetPosts :many
SELECT * FROM posts WHERE user_id = $1;
# Generate Go code
sqlc generate
Follow the existing patterns in internal/.
Add types in apps/web/src/lib/types/.
cd apps/web
pnpm build
npx wrangler pages deploy .svelte-kit/cloudflare
MIT