Skip to content

voidly-labs/simc-nextjs-web

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SimC Next.js web example

Next.js example for the Simmit API. Paste a SimulationCraft (SimC) profile, submit it through the official @simmit/sdk, and follow the job from a live status page to a result page with the DPS and a link to the full SimC report. The textarea accepts a hand-edited SimC profile or the in-game WoW SimulationCraft addon export.

A Simmit job is one SimC run: you submit a profile, Simmit queues and runs it in the cloud, and you fetch the result when it's done.

Setup

Requires Node 20.9+. You'll need a Simmit secret key from dashboard.simmit.com.

cp .env.example .env       # paste your key into SIMMIT_SECRET_KEY
npm install
npm run dev

Try it

Paste a profile and run it. You land on a status page that polls until the sim finishes, then a result page with the DPS and its error margin. The job id lives in the URL, so /jobs/<id> and /jobs/<id>/result are real pages you can link to or reload.

The home page: a Run SimC Profile heading, a textarea for pasting a SimulationCraft profile, and a Run sim button. The status page while a job runs, showing a running indicator at 42 percent, a progress bar, and the job ID. The result page after a completed sim, showing the DPS with its error margin and a link to the full SimC report.

How it works

The sample wires the SDK across three routes. A Server Action calls jobs.create and redirects to /jobs/[id]; that page calls jobs.getStatus on each render and redirects to the result once the job is terminal; the result page reads jobs.getResult for the DPS. The status page is a Server Component, and a small client component calls router.refresh() on an interval to re-run it, so there is no client-side poll loop or status endpoint to hand-write.

The key never reaches the browser. lib/simmit.ts builds the SDK client and is marked server-only, so the build fails if it is ever pulled into a client component. Every Simmit call runs in a Server Action or Server Component, and the secret key stays on the server.

Going further

  • Webhooks instead of polling. Register a job.terminal webhook, drop the refresh loop, and verify the callback with the SDK's unwrapWebhook. See the webhooks docs.
  • Match your site's design. Override the CSS custom properties in app/globals.css (--accent, --bg, --fg, --border, --radius).
  • Persist sims server-side. This sample keeps recent job ids in localStorage; a real app would save each id to its database keyed by user, so a sim survives a new device or a cleared browser.
  • Embed the report. Swap the report link for an <iframe> of the HTML artifact from jobs.getResult, or fetch its URL on demand with artifacts.getUrl.
  • More SimC options. Add fight length, target count, or iteration fields and append them to the profile text before submit.

Upstream

SimulationCraft is an independent open-source project. This example and the Simmit API are not affiliated with or endorsed by SimulationCraft. Simmit executes unmodified upstream SimC binaries.

License

MIT. See LICENSE.

About

Next.js example for running SimulationCraft (SimC) sims through the Simmit API. Paste a SimC profile, watch the job run on a status page, and get the DPS and a SimC report link.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors