A modern full-stack web application built with SvelteKit, featuring authentication, database integration, and social media functionality.
Before running this project, ensure you have the following installed:
Clone the repository
git clone <repository-url>
cd svelte-x-demo
Install dependencies
pnpm install
Set up environment variables
cp .env.example .env
Update the .env file with your configuration:
DATABASE_URL=file:local.db
BETTER_AUTH_URL=http://localhost:5173
BETTER_AUTH_SECRET=your-secret-key
GOOGLE_CLIENT_ID=your-google-client-id
GOOGLE_CLIENT_SECRET=your-google-client-secret
GITHUB_CLIENT_ID=your-github-client-id
GITHUB_CLIENT_SECRET=your-github-client-secret
GOOGLE_GENERATIVE_AI_API_KEY=your-google-ai-api-key
TURSO_DATABASE_URL=your-turso-database-url
TURSO_AUTH_TOKEN=your-turso-auth-token
Initialize the database
pnpm db:generate
pnpm db:migrate
pnpm db:seed
Start the development server:
pnpm dev
The application will be available at http://localhost:5173
pnpm dev - Start development serverpnpm build - Build for productionpnpm preview - Preview production buildpnpm db:generate - Generate database migrationspnpm db:migrate - Run database migrationspnpm db:seed - Seed database with sample datapnpm db:migrate:prod - Run production migrationspnpm db:migrate:data - Migrate data to cloud databaseThe project uses SQLite for local development. The database file (local.db) is automatically created when you run migrations.
For production, we recommend using Turso or another cloud database:
pnpm db:migrate:prod
http://localhost:5173/api/auth/callback/google (development)https://your-domain.vercel.app/api/auth/callback/google (production)http://localhost:5173/api/auth/callback/github (development)https://your-domain.vercel.app/api/auth/callback/github (production)Push to GitHub
git add .
git commit -m "Initial commit"
git push origin main
Connect to Vercel
Set Environment Variables Add the following variables in Vercel dashboard:
DATABASE_URL=your-cloud-database-url
BETTER_AUTH_URL=https://your-app.vercel.app
BETTER_AUTH_SECRET=your-production-secret
GOOGLE_CLIENT_ID=your-google-client-id
GOOGLE_CLIENT_SECRET=your-google-client-secret
GITHUB_CLIENT_ID=your-github-client-id
GITHUB_CLIENT_SECRET=your-github-client-secret
GOOGLE_GENERATIVE_AI_API_KEY=your-google-ai-api-key
TURSO_DATABASE_URL=your-turso-database-url
TURSO_AUTH_TOKEN=your-turso-auth-token
Deploy and run migrations After successful deployment, run production migrations if needed.
src/
āāā lib/
ā āāā components/ # Reusable UI components
ā āāā server/ # Server-side utilities
ā ā āāā db/ # Database schema and utilities
ā āāā stores/ # Svelte stores
ā āāā utils/ # Utility functions
ā āāā auth.ts # Authentication configuration
ā āāā auth-client.ts # Client-side auth utilities
āāā routes/ # SvelteKit routes
ā āāā api/ # API endpoints
ā āāā auth/ # Authentication routes
ā āāā users/ # User-related pages
āāā app.html # HTML template
git checkout -b feature/amazing-feature)git commit -m 'Add amazing feature')git push origin feature/amazing-feature)This project is licensed under the MIT License - see the LICENSE file for details.
For support and questions: