A starter template for building web applications with:
- Vue 3
- Nuxt 3
- CockroachDB
- Google OAuth Authentication
- Tailwind CSS
-
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:password@free-tier.gcp-us-central1.cockroachlabs.cloud:26257/starter?sslmode=verify-full
-
Create a
.env
file 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.pem
andlocalhost-key.pem
in 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:migrate
To create a new migration:
npm run db:create-migration your-migration-name
This creates a new migration file in the migrations/sql
directory.
assets/
- Static assets and CSScomponents/
- Vue componentslayouts/
- Page layoutsmiddleware/
- Route middlewaremigrations/
- Database migrationspages/
- Application pages and routespublic/
- Public static filesserver/
- Server-side codeapi/
- API endpointsutils/
- Server utilities
stores/
- Pinia storestypes/
- TypeScript type definitionsutils/
- Utility functions
- Authentication: Google OAuth integration
- Database: CockroachDB with migration system
- State Management: Pinia with persistence
- Styling: Tailwind CSS with custom components
- TypeScript: Full TypeScript support
- Routing: Nuxt's file-based routing system
- 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_ID
in your.env
file