A browser-based tycoon game built with Godot 4.x where players manage a coffee shop, serve customers, and upgrade equipment. Uses Credyt wallet API for the in-game economy.
- Node.js 18+ (https://nodejs.org)
- PostgreSQL 14+ (https://postgresql.org)
- Credyt API Account (https://credyt.ai) - for wallet/economy features
- Godot Engine 4.6+ (https://godotengine.org/download)
coffeeshoptycoon/
├── project.godot # Godot project file
├── scenes/ # Godot scenes (.tscn files)
├── scripts/ # GDScript files
├── assets/ # Sprites, audio, fonts
├── backend/ # Node.js API server
│ ├── src/
│ │ ├── routes/ # API endpoints
│ │ ├── services/ # Business logic (Credyt integration)
│ │ ├── middleware/ # Auth middleware
│ │ ├── db/ # Database queries and setup
│ │ └── index.js # Server entry point
│ ├── package.json
│ └── .env # Configuration (copy from .env.example)
└── README.md
The easiest way to get started is using Docker Compose:
# Start PostgreSQL database
docker-compose up -d
# Install backend dependencies
cd backend
npm install
# Initialize database tables
npm run db:init
# Start the backend server
npm run devThe database will be available at localhost:5432 with:
- User:
coffeeshop - Password:
coffeeshop123 - Database:
coffeeshoptycoon
cd backend
npm installEdit backend/.env with your settings:
# Database - PostgreSQL connection string
# If using Docker Compose:
DATABASE_URL=postgresql://coffeeshop:coffeeshop123@localhost:5432/coffeeshoptycoon
# If using your own PostgreSQL:
# DATABASE_URL=postgresql://user:password@localhost:5432/coffeeshoptycoon
# Database SSL (optional) - Set to 'true' to enable SSL, 'false' to disable
# Default: auto-detect based on NODE_ENV (enabled in production, disabled in development)
# DATABASE_SSL=false
# JWT Secret - use a strong random string in production
JWT_SECRET=your-super-secret-jwt-key-change-in-production
# Credyt API - get credentials from https://credyt.ai
CREDYT_API_URL=https://api.credyt.ai
CREDYT_API_KEY=your-credyt-api-key
CREDYT_PRODUCT_ID=your-credyt-product-id
# Server
PORT=3000
NODE_ENV=development# From project root
docker-compose up -dInitialize the tables:
cd backend
npm install
npm run db:initDevelopment mode (auto-reload):
npm run devProduction mode:
npm startThe API will be available at http://localhost:3000.
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/auth/register |
Create account + Credyt wallet |
| POST | /api/auth/login |
Login, returns JWT |
| GET | /api/auth/validate |
Validate JWT token |
| GET | /api/shop |
Get shop state |
| GET | /api/shop/costs |
Get equipment upgrade and restock costs |
| GET | /api/shop/limits |
Get inventory capacity and consumption limits |
| PUT | /api/shop/inventory |
Update inventory |
| POST | /api/shop/restock |
Purchase inventory |
| POST | /api/shop/upgrade |
Purchase equipment upgrade |
| POST | /api/shop/reset |
Reset shop to initial state |
| POST | /api/shop/serve |
Log customer transaction and update balance |
| POST | /api/day/complete |
Submit day results |
| GET | /api/wallet/balance |
Get wallet balance |
| POST | /api/wallet/billing-portal |
Create billing portal session |
- Open Godot Engine 4.6+
- Click "Import"
- Navigate to the project folder and select
project.godot - Click "Import & Edit"
For development, the game connects to http://localhost:3000/api by default.
Press F5 or click the Play button in Godot to run the game.
In Godot: Editor → Manage Export Templates → Download and Install
- Project → Export
- Add Preset → Web
- Configure settings (defaults should work)
- Click "Export Project"
- Choose destination folder
- Name the file (e.g.,
index.html)
Web exports require a local server due to browser security. Use one of:
# Python
python -m http.server 8080
# Node.js (npx)
npx serve .
# PHP
php -S localhost:8080- Sign up at https://credyt.ai and get your API key
- Add your API key to
backend/.env:CREDYT_API_KEY=your-api-key-here - Run the setup script:
cd backend npm run credyt:setup
The script will:
- Check if "Coffee Shop Tycoon" product exists in your Credyt account (by product code)
- If exists: Create a new version with updated prices and make it the default
- If not exists: Create a new product with all prices
- Automatically update your
.envfile with theCREDYT_PRODUCT_ID
Requirements: curl and jq must be installed. On macOS: brew install jq
- Sign up at https://credyt.ai
- Create a new product named "Coffee Shop Tycoon"
- Copy the Product ID
- Add both to
backend/.env:CREDYT_API_KEY=your-api-key CREDYT_PRODUCT_ID=your-product-id
The game uses Credyt for:
- Creating player wallets on registration
- Granting starting funds ($50)
- Crediting revenue at end of day
- Debiting purchases (restocks, upgrades)
- Transaction tracking and billing
- Morning Prep: Restock pastries, review shop
- Service Phase: 60-second session serving customers
- End of Day: Revenue credited, view stats, upgrade shop
- Coffee (made on demand): Espresso ($3.25), Latte ($5.72), Cappuccino ($5.95), Americano ($4.75)
- Pastries (require restocking): Croissant ($5.15), Muffin ($4.75), Cookie ($4.75), Cake Slice ($5.55)
| Equipment | Level 1 | Level 2 ($500) | Level 3 ($1500) |
|---|---|---|---|
| Espresso Machine | Basic Brewer | Pro Barista | Master Roaster |
| 1x speed, 1x quality | 1.3x speed, 1.2x quality | 1.6x speed, 1.5x quality |
| Equipment | Level 1 | Level 2 ($60) | Level 3 ($100) |
|---|---|---|---|
| Display Case | Small (5 items) | Medium (10 items) | Large (20 items) |
| 1x freshness | 1.2x freshness | 1.5x freshness |
- Starting funds: $50
- Tips scale with customer patience and equipment quality
- Equipment quality and freshness affect customer satisfaction
-
Autoloads (
scripts/autoloads/): Singletons for global stateGameManager: Game state, shop data, menu itemsAuthManager: Authentication stateAPIClient: HTTP requests to backendEvents: Signal bus for decoupled events
-
Systems (
scripts/systems/): Game logicday_cycle_system.gd: Phase state machinecustomer_spawner.gd: Customer generationorder_system.gd: Order fulfillment
- Ensure PostgreSQL is running
- Verify DATABASE_URL in .env is correct
- Check that the database exists
- Verify CREDYT_API_KEY and CREDYT_PRODUCT_ID in .env
- Check you're using test mode credentials for development
- Ensure your Credyt account is active
- Ensure backend ALLOWED_ORIGINS includes your game's URL
- For development, the backend allows all origins by default
- Ensure all .tscn and .gd files are in the correct paths
- Check Godot console for error messages
- Verify autoloads are configured in Project Settings
The fonts Edit Undo and EXEPixelPerfect were found on 1001fonts.com and are available here: