The KEKwallet application uses Google Cloud SQL for its database infrastructure. This document outlines the setup and configuration process.
- Google Cloud SDK installed
- Access to Google Cloud project (lordkekwallet-prod)
- Service account with necessary permissions
- Instance Name: kekwallet-db
- Connection Name: lordkekwallet-prod:us-central1:kekwallet-db
- Region: us-central1
- Database Version: MySQL 8.0
- Project ID: lordkekwallet-prod
-
Database Connection String The application uses a MySQL connection string in the following format:
mysql://user:password@lordkekwallet-prod:us-central1:kekwallet-db/kekwallet?ssl=true
Where:
user
: Database userpassword
: Database passwordkekwallet
: Database name
-
Environment Variables Set the following in your
.env
file:DATABASE_URL=mysql://user:password@lordkekwallet-prod:us-central1:kekwallet-db/kekwallet?ssl=true
-
Service Account
- Use the provided service account key file for authentication
- File:
lordkekwallet-prod-e58d5b12b6a1.json
- Service account email: [email protected]
# Push schema changes to database
pnpm db:push
# Open database management studio
pnpm db:studio
The database schema is managed using Drizzle ORM and can be found in shared/db/schema.ts
. The schema includes:
- User management
- Wallet associations
- Push notification subscriptions
- Timestamps for record keeping
- Always use SSL for database connections
- Keep service account keys secure
- Follow principle of least privilege for database users
- Regular backup and monitoring recommended
When deploying to production:
- Ensure proper firewall rules are configured
- Use production-ready connection pool settings
- Monitor connection limits and usage
- Configure automated backups
For local development:
- Install Google Cloud SQL Auth proxy:
gcloud components install cloud_sql_proxy
- Start the proxy:
cloud_sql_proxy lordkekwallet-prod:us-central1:kekwallet-db
- Use localhost in your connection string when running with the proxy