Skip to content

veermshah/hacktx2025

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🎵 Tuner - Natural Language Trading & Backtesting Platform

A powerful trading platform that allows you to create, test, and manage trading rules using natural language.

🚀 Tech Stack

  • Next.js 15 (App Router)
  • TypeScript
  • Supabase (Authentication & Database)
  • TailwindCSS
  • React Icons

✨ Features

  • ✅ Email & OAuth authentication (Google, GitHub)
  • ✅ Protected routes with middleware
  • ✅ User dashboard with trading rules management
  • ✅ PostgreSQL database with Row Level Security
  • ✅ RESTful API routes for rules CRUD operations
  • ✅ Beautiful, animated UI

🛠️ Setup

1. Install Dependencies

npm install

2. Environment Variables

Your .env.local file is already configured with:

NEXT_PUBLIC_SUPABASE_URL=https://jtzoprtqyihyqybqkakx.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key

3. Set Up Database

  1. Go to your Supabase SQL Editor
  2. Run the SQL in supabase-schema.sql

This creates the rules table with proper RLS policies.

4. Configure OAuth (Optional)

In your Supabase Dashboard → Authentication → Providers:

  • Enable Google and/or GitHub
  • Add OAuth credentials from respective platforms

5. Run Development Server

npm run dev

Open http://localhost:3000

📁 Project Structure

src/
├── app/
│   ├── api/rules/          # API routes for rules CRUD
│   ├── auth/callback/      # OAuth callback
│   ├── dashboard/          # Protected dashboard
│   ├── login/              # Login page
│   ├── signup/             # Signup page
│   └── layout.tsx
├── components/
│   └── Navbar.tsx
├── lib/
│   ├── supabase.ts         # Original Supabase client
│   ├── supabase-client.ts  # Browser client (SSR)
│   └── supabase-server.ts  # Server client (SSR)
└── middleware.ts           # Route protection

🔐 Authentication Flow

  1. Sign up at /signup with email or OAuth
  2. Confirm email (if using email auth)
  3. Sign in at /login
  4. Access dashboard at /dashboard

📊 Database Schema

rules Table

Column Type Description
id UUID Primary key
user_id UUID Foreign key to auth.users
rule JSONB Trading rule data
status TEXT 'active' or 'inactive'
created_at TIMESTAMP Creation time

🔌 API Routes

Rules API

GET /api/rules - Get all user's rules
POST /api/rules - Create a new rule
PATCH /api/rules/[id] - Update a rule
DELETE /api/rules/[id] - Delete a rule

Example Usage

// Create a rule
const response = await fetch("/api/rules", {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({
        rule: {
            condition: "If RSI < 30",
            action: "Buy",
            parameters: { indicator: "RSI", threshold: 30 },
        },
        status: "active",
    }),
});

🎨 Features Overview

Dashboard

  • View all trading rules
  • Create demo rules
  • See statistics (total, active, inactive)
  • Sign out

Protected Routes

Middleware automatically:

  • Redirects unauthenticated users from /dashboard/login
  • Redirects authenticated users from /login, /signup/dashboard

📝 Next Steps

  1. ✅ Run the database schema SQL
  2. ✅ Test authentication flow
  3. 🔜 Build natural language rule parser
  4. 🔜 Add backtesting engine
  5. 🔜 Connect to trading APIs
  6. 🔜 Add real-time data feeds

📚 Learn More

🚀 Deploy on Vercel

The easiest way to deploy:

vercel

Make sure to add your environment variables in Vercel dashboard!


Built with ❤️ for HackTX 2025

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages