Loading...
Loading...

A cryptocurrency analysis and monitoring platform built with Next.js, deployed on Cloudflare Workers with D1 database.
| Category | Technology |
|----------|-----------|
| **Framework** | Next.js 14 (App Router) |
| **Language** | TypeScript |
| **Styling** | Tailwind CSS |
| **Charts** | Recharts |
| **Icons** | Lucide React |
| **Hosting** | Cloudflare Workers |
| **Database** | Cloudflare D1 (SQLite-compatible) |
| **API** | CoinGecko (free tier) |
| **Adapter** | @opennextjs/cloudflare |
cryptonexus/
├── migrations/ # D1 database migrations
│ └── 001_initial.sql # Initial schema + seed data
├── public/ # Static assets
│ └── _headers # Cache control headers
├── src/
│ ├── app/ # Next.js App Router
│ │ ├── page.tsx # Dashboard (home)
│ │ ├── layout.tsx # Root layout
│ │ ├── globals.css # Global styles
│ │ ├── login/ # Login/Register page
│ │ ├── analysis/ # Crypto analysis pages
│ │ │ ├── page.tsx # "Select a crypto" placeholder
│ │ │ └── [symbol]/ # Dynamic route per crypto
│ │ ├── news/ # News feed with sentiment
│ │ ├── settings/ # User settings
│ │ ├── subscribe/ # Subscription/payment page
│ │ └── api/ # API routes
│ │ ├── auth/ # POST: login, register, update
│ │ ├── prices/ # GET: live CoinGecko prices
│ │ └── subscription/ # POST: activate/check subscription
│ ├── components/ # React components
│ │ ├── DashboardClient.tsx # Main dashboard grid
│ │ ├── AnalysisClient.tsx # Detailed analysis view
│ │ ├── AuthContext.tsx # Auth state management
│ │ ├── Navbar.tsx # Top navigation
│ │ ├── NewsClient.tsx # News feed
│ │ ├── PaymentModal.tsx # Mock payment modal
│ │ └── SettingsContext.tsx # Theme + i18n context
│ └── lib/ # Shared utilities
│ ├── db.ts # D1 database operations
│ └── prices.ts # CoinGecko price fetching
├── open-next.config.ts # OpenNext Cloudflare config
├── wrangler.jsonc # Wrangler (Cloudflare) config
├── next.config.js # Next.js configuration
├── tailwind.config.ts # Tailwind configuration
├── postcss.config.js # PostCSS configuration
├── tsconfig.json # TypeScript configuration
└── package.json # Dependencies & scripts
1. **Clone the repository**
git clone https://github.com/tianreformis/com.tianreformis.cryptonexus.git
cd cryptonexus
2. **Install dependencies**
npm install
3. **Run the development server**
npm run dev
Open [http://localhost:3000](http://localhost:3000) in your browser.
1. **Login to Wrangler**
npx wrangler login
2. **Create a D1 database**
npm run db:create
Copy the `database_id` from the output and update `wrangler.jsonc`:
"d1_databases": [
{
"binding": "DB",
"database_name": "cryptonexus",
"database_id": "YOUR_DATABASE_ID_HERE",
"migrations_dir": "migrations"
}
]
3. **Apply database migrations**
npm run db:migrate
npm run db:migrate:local
4. **Generate Cloudflare types**
npm run cf-typegen
5. **Preview locally**
npm run preview
6. **Deploy to Cloudflare**
npm run deploy
| Script | Description |
|--------|-------------|
| `npm run dev` | Start Next.js dev server (Node.js) |
| `npm run build` | Build Next.js for production |
| `npm run start` | Start production server (Node.js) |
| `npm run lint` | Run ESLint |
| `npm run preview` | Build and preview locally in Workers runtime |
| `npm run deploy` | Build and deploy to Cloudflare Workers |
| `npm run upload` | Build and upload version (no deploy) |
| `npm run cf-typegen` | Generate Cloudflare binding types |
| `npm run db:create` | Create a new D1 database |
| `npm run db:migrate` | Apply migrations to remote D1 |
| `npm run db:migrate:local` | Apply migrations to local D1 |
Fetches live cryptocurrency prices from CoinGecko API.
**Response:**
{
"BTC": { "price": 67091, "change24h": -0.4, "volume24h": 42808182670, "marketCap": 1344413636694 },
"ETH": { "price": 2044.19, "change24h": -0.08, "volume24h": 17123820881, "marketCap": 247131136819 }
}
Authentication endpoint.
**Register:**
{ "action": "register", "email": "user@example.com", "password": "secret", "name": "John" }
**Login:**
{ "action": "login", "email": "user@example.com", "password": "secret" }
**Update Profile:**
{ "action": "update", "userId": 1, "name": "New Name" }
Subscription management.
**Activate:**
{ "action": "subscribe", "userId": 1, "subscriptionType": "monthly" }
**Check Status:**
{ "action": "status", "userId": 1 }
**`users`** — User accounts and subscription data
| Column | Type | Description |
|--------|------|-------------|
| id | INTEGER | Primary key, auto-increment |
| email | TEXT | Unique email address |
| password | TEXT | SHA-256 hashed password |
| name | TEXT | Display name |
| created_at | DATETIME | Account creation timestamp |
| trial_start_date | DATETIME | When free trial started |
| is_subscribed | INTEGER | 0 = free, 1 = paid |
| subscription_expires | DATETIME | Subscription expiry date |
| subscription_type | TEXT | 'trial', 'monthly', or 'yearly' |
**`cryptos`** — Cryptocurrency price data
| Column | Type | Description |
|--------|------|-------------|
| id | INTEGER | Primary key, auto-increment |
| symbol | TEXT | Unique symbol (BTC, ETH, etc.) |
| name | TEXT | Full name (Bitcoin, Ethereum, etc.) |
| current_price | REAL | Current price in USD |
| price_change_24h | REAL | 24-hour price change percentage |
| volume_24h | REAL | 24-hour trading volume |
| market_cap | REAL | Market capitalization |
| last_updated | DATETIME | Last price update timestamp |
**`recommendations`** — Trading recommendations
| Column | Type | Description |
|--------|------|-------------|
| id | INTEGER | Primary key, auto-increment |
| crypto_id | INTEGER | Foreign key to cryptos |
| recommendation | TEXT | 'long', 'short', or 'neutral' |
| take_profit | REAL | Suggested take profit price |
| stop_loss | REAL | Suggested stop loss price |
| confidence | REAL | Confidence score (0-1) |
| created_at | DATETIME | Creation timestamp |
**`news`** — Crypto news with sentiment
| Column | Type | Description |
|--------|------|-------------|
| id | INTEGER | Primary key, auto-increment |
| crypto_id | INTEGER | Foreign key to cryptos |
| title | TEXT | News article title |
| source | TEXT | News source name |
| sentiment_score | REAL | Sentiment (-1 to 1) |
| published_at | DATETIME | Publication date |
The project is configured for Cloudflare Workers. Simply run:
npm run deploy
You can set up automatic deployments by connecting your GitHub repository to Cloudflare Pages or using GitHub Actions with Wrangler.
| Variable | Description | Default |
|----------|-------------|---------|
| `NEXTJS_ENV` | Environment mode for .env loading | `production` |
Defined in `.dev.vars` for local development.
These limits are sufficient for personal use and small-scale testing.
Private — All rights reserved.