A modern full-stack starter template for building scalable web applications with authentication and a distributed SQL database.
This template provides a production-ready foundation with:
- Frontend: Vue 3 + Nuxt 3 (SSR-ready)
- Authentication: Google OAuth with session management
- Database: CockroachDB (distributed SQL, PostgreSQL-compatible)
- Styling: Tailwind CSS for rapid UI development
- Type Safety: Full TypeScript support
- Developer Experience: Hot reload, auto-imports, and file-based routing
-
Clone this repository
-
Install dependencies:
npm install
-
Set up CockroachDB:
- Sign up or log in at cockroachlabs.cloud
- Create a new cluster (or use an existing one)
- From the SQL console, create a new database:
CREATE DATABASE starter;
- Get your connection string from the "Connect" tab. It will look something like:
postgresql://username:[email protected]:26257/starter?sslmode=verify-full
-
Create a
.envfile based on.env.example:cp .env.example .env
-
Configure your environment variables:
NUXT_PUBLIC_GOOGLE_CLIENT_ID: Google OAuth client ID (create one at Google Cloud Console)DATABASE_URL: Your CockroachDB connection string from step 3
-
For local development with HTTPS (required for Google OAuth), generate certificates:
mkcert localhost
This will create
localhost.pemandlocalhost-key.pemin the root directory. -
Run the database migrations:
npm run db:migrate
-
Start the development server:
npm run dev
To apply all pending migrations:
npm run db:migrateTo create a new migration:
npm run db:create-migration your-migration-nameThis creates a new migration file in the migrations/sql directory.
├── pages/ # File-based routing
├── server/ # Backend API and utilities
│ └── api/ # API endpoints (public/ and protected)
├── components/ # Reusable Vue components
├── stores/ # Pinia state management
├── types/ # Shared TypeScript types
├── migrations/ # Database schema versioning
└── middleware/ # Route guards and auth
## Features
- **Authentication**: Google OAuth with automatic token verification
- **Database**: CockroachDB with custom migration system
- **State Management**: Pinia with persistence across sessions
- **Styling**: Tailwind CSS with Lucide icons
- **Type Safety**: Shared TypeScript types across client and server
- **API**: RESTful endpoints with built-in auth protection
## 🤔 Why This Stack?
- **CockroachDB**: Distributed SQL that scales horizontally while staying PostgreSQL-compatible
- **Nuxt 3**: Modern Vue framework with SSR, auto-imports, and excellent developer experience
- **Google OAuth**: Secure, widely-adopted authentication that users trust
- **TypeScript**: Catch errors at build time and improve developer productivity
- **File-based routing**: Intuitive project organization that scales with your application
## 🚀 Deployment
This template is designed to deploy easily to modern platforms:
- **Vercel**: Zero-config deployment with automatic HTTPS
For production, ensure you:
1. Set environment variables in your hosting platform
2. Run migrations against your production database
3. Configure your OAuth redirect URLs for your domain
## 📚 Documentation
For development guidance, see the project's CLAUDE.md files:
- Development patterns and best practices
- API endpoint creation and database operations
- Migration system details
## 🛠️ Troubleshooting
**HTTPS Certificate Issues**: If `mkcert localhost` fails, install mkcert first:
```bash
# macOS
brew install mkcert
# Other platforms: see https://github.com/FiloSottile/mkcert#installation
Database Connection: Ensure your CockroachDB cluster is active and the connection string includes the correct database name.
OAuth Errors: Verify your Google OAuth client ID and that localhost:3000 is in your authorized origins.
- Go to the Google Cloud Console
- Create a new project (or select an existing one)
- Navigate to "APIs & Services" > "Credentials"
- Create an OAuth client ID (Web application type)
- Add authorized JavaScript origins:
https://localhost:3000(for local development)
- Add authorized redirect URIs:
https://localhost:3000(for local development)
- Copy the Client ID and use it as the
NUXT_PUBLIC_GOOGLE_CLIENT_IDin your.envfile