This is a Next.js project bootstrapped with v0.
This repository is linked to a v0 project. You can continue developing by visiting the link below -- start new chats to make changes, and v0 will push commits directly to this repo. Every merge to main will automatically deploy.
Copy .env.local.example to .env.local and fill in the values:
| Variable | Required | Description |
|---|---|---|
DATABASE_URL |
Yes | PostgreSQL connection string |
AUTH_SECRET |
Yes | NextAuth secret |
INTERNAL_API_KEY |
Yes | Random secret for scheduler/internal API calls (x-api-key header) |
GOLD_API_KEY |
Optional | goldapi.io key for XAU/IDR price (free tier: 100 req/month). Falls back to CoinGecko + open exchange rate if absent. |
GOOGLE_CLIENT_ID |
Optional | Google OAuth client ID (Google Cloud Console → APIs & Services → Credentials) |
GOOGLE_CLIENT_SECRET |
Optional | Google OAuth client secret |
POST /api/market/prices/update (requires x-api-key: <INTERNAL_API_KEY> header):
- Queries all distinct tickers from every user's holdings
- Stocks (IDX): fetches via Yahoo Finance
/v8/finance/chart/{ticker}.JK→ price in IDR - Crypto: resolves symbol → CoinGecko ID via search, then fetches
simple/price→ price in USD - Gold (XAU): fetches from goldapi.io (
GOLD_API_KEY) or falls back to CoinGecko tether-gold × USD/IDR - Upserts all prices to
asset_prices
Manual single-ticker override: PUT /api/market/prices/{ticker} (requires user session).
The app is open for anyone to try without signing up. Use:
| Field | Value |
|---|---|
| demo@rizkiandrianto.com | |
| Password | demo1234 |
The demo account is read-only. You can browse every page and see sample data, but any attempt to add, edit, or delete will:
- Server: return
401 UnauthorizedfromPOST/PUT/PATCH/DELETEon/api/*(enforced bysrc/proxy.tscheckingsession.user.isDemo). - UI: open a "Demo account" notice dialog explaining the limitation,
before the network request is fired (via
useGuardedMutation).
The users table has an is_demo BOOLEAN DEFAULT FALSE column. Only rows
where is_demo = true are subject to the read-only guard.
pnpm seed:demoCreates the demo user (idempotent) and inserts a minimal portfolio (bank +
cash accounts, one stock, one crypto, one transaction) so the dashboard is
non-empty. See seed/demo/README.md for details.
First, run the development server:
npm run dev
# or
yarn dev
# or
pnpm devOpen http://localhost:3000 with your browser to see the result.
You can start editing the page by modifying app/page.tsx. The page auto-updates as you edit the file.
To learn more, take a look at the following resources:
- Next.js Documentation - learn about Next.js features and API.
- Learn Next.js - an interactive Next.js tutorial.
- v0 Documentation - learn about v0 and how to use it.