A web application for tracking Counter Strike 2 items built with NextJS and Supabase.
Each item includes:
Each investment tracks:
bun install
.env.local
file in the project root with your Supabase credentials:
NEXT_PUBLIC_SUPABASE_URL=your-supabase-url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-supabase-anon-key
# Optional: CSFloat API key for fetching item prices
NEXT_PUBLIC_CSFLOAT_API_KEY=your-csfloat-api-key
cs_items
with the following schema:
create table cs_items (
id bigint generated by default as identity primary key,
def_index integer not null,
def_name text not null,
paint_index integer,
paint_name text,
max_float numeric,
min_float numeric,
category integer not null default 0,
market_hash_name text,
image_url text,
created_at timestamp with time zone default now()
);
investments
with the following schema:
create table investments (
id uuid primary key default gen_random_uuid(),
item_id bigint not null references cs_items(id) on delete cascade,
purchase_date date not null,
purchase_price decimal(10, 2) not null,
quantity integer not null default 1,
created_at timestamp with time zone default now()
);
cs-items-images
# Or using homebrew on macOS brew install supabase/tap/supabase
- Link your local project to your Supabase project:
```bash
supabase login
supabase link --project-ref your-project-ref
supabase db push
Or, if you want to include the seed data:
supabase db push --include-seed
bun dev
This project uses Supabase migrations to manage the database schema. The migrations are located in the supabase/migrations
directory.
00000000000001_create_cs_items_table.sql
: Creates the cs_items
table and sets up RLS policies00000000000002_create_storage_bucket.sql
: Creates the storage bucket for CS2 item images and sets up storage policies00000000000003_update_rls_policies.sql
: Updates row-level security policies00000000000004_create_investments_table.sql
: Creates the investments
table for tracking purchasesThe project includes a seed file (supabase/seed.sql
) with example CS2 items to get you started.
To apply the migrations to your Supabase project, run:
supabase db push
To apply the migrations and seed data:
supabase db push --include-seed
For local development with Supabase, you can use the Supabase CLI:
# Start a local Supabase instance
supabase start
# Apply migrations to the local instance
supabase db reset
# Stop the local instance when done
supabase stop
This application integrates with the CSFloat API to fetch current market prices for CS2 items. The integration:
To use the CSFloat API features:
.env.local
file:
NEXT_PUBLIC_CSFLOAT_API_KEY=your-csfloat-api-key
Note: Without an API key, price data will not be available or may be rate-limited.