Full lesson
Circuit-
Circuit is a made-to-order fashion brand , with Solana blockchain infrastructure; where garments are only produced after demand is confirmed. Buyers pay into on-chain escrow, garments are minted as NFTs at production, and resale royalties plus verifiable provenance are enforced by smart contracts.
What it does
From the project README:
Circuit is a premier made-to-order fashion platform powered by Solana. We redefine the fashion supply chain by producing garments only after demand is confirmed on-chain.
- Original
- circuit-sol/Circuit-
- SuperStack fork
- Blockchains/Circuit- @
3004e0f - Stars
- 1
- Last push (original)
- 2026-10-25
- Languages
- TypeScript, JavaScript, CSS, PLpgSQL, HTML, Rust
- Detected stack
- AnchorMetaplexNext.jsweb3.js
- Categories
- PaymentsNFTs & Digital Assets
- Licence
- MIT
- Homepage
- https://circuit-one.vercel.app
Architecture
60 source files. By extension: .tsx ×24, .js ×21, .ts ×12, .rs ×3.
| Top-level directory | Source files |
|---|---|
app | 32 |
backend | 17 |
programs | 3 |
scripts | 2 |
tests | 2 |
(root) | 1 |
_old | 1 |
vertical | 1 |
On-chain programs: programs/circuit-drops, programs/circuit-escrow
Dapp: devnet deploy pending
⏳ Devnet deploy pending — goes live when the devnet wallet is topped up. This fork's own dapp is not deployed yet, so there is no program address or transaction to show. It is queued in dapp-queue.txt; once devnet SOL is available it is deployed, exercised with real devnet transactions, and this section switches to the live dapp at /dapps/circuit-/. Until then, the lesson and step-by-step guide below are complete, and you can run it locally with the commands below.
Key code, explained
Excerpts chosen automatically where the code uses the most Solana concepts, pinned to the fork's commit.
programs/circuit-escrow/src/lib.rs L361–384 @ 3004e0f · MIT · original pub quote_expires_at: i64,} #[derive(Accounts)]pub struct InitializeVault<'info> { #[account(mut)] pub payer: Signer<'info>, #[account(seeds = [b"circuit-config"], bump = config.bump, seeds::program = circuit_drops::ID, constraint = config.version == POLICY_VERSION @ EscrowError::UnsupportedPolicy)] pub config: Account<'info, CircuitConfig>, #[account(seeds = [b"batch", batch.batch_id.as_ref()], bump = batch.bump, seeds::program = circuit_drops::ID, has_one = config @ EscrowError::WrongConfig)] pub batch: Account<'info, BatchAccount>, #[account(init, payer = payer, space = 8 + BatchVault::INIT_SPACE, seeds = [b"batch-vault", batch.key().as_ref()], bump)] pub vault: Account<'info, BatchVault>, pub system_program: Program<'info, System>,} #[derive(Accounts)]#[instruction(args: PurchaseArgs)]pub struct Purchase<'info> {- Line 367
pub payer: Signer<'info>,: Requires this account to have signed the transaction. - Line 368
#[account(seeds = [b"circuit-config"], bump = config.bump,: Declares the PDA seeds. Anchor re-derives the address and rejects the account if it doesn't match. - Line 368
#[account(seeds = [b"circuit-config"], bump = config.bump,: Uses the bump seed, the extra byte that pushes the derived address off the ed25519 curve. - Line 374
has_one = config @ EscrowError::WrongConfig)]: Checks that a stored pubkey field matches the passed account. - Line 376
#[account(init, payer = payer, space = 8 + BatchVault::INIT_SPACE,: Creates and pays for a new account. Space and payer must be specified.
programs/circuit-drops/src/lib.rs L133–156 @ 3004e0f · MIT · original pub program: Program<'info, CircuitDrops>, #[account( constraint = program_data.upgrade_authority_address == Some(upgrade_authority.key()) @ DropsError::UnauthorizedUpgradeAuthority )] pub program_data: Account<'info, ProgramData>, #[account(init, payer = upgrade_authority, space = 8 + CircuitConfig::INIT_SPACE, seeds = [b"circuit-config"], bump)] pub config: Account<'info, CircuitConfig>, pub system_program: Program<'info, System>,} #[derive(Accounts)]pub struct SetPlatformAuthority<'info> { pub admin_authority: Signer<'info>, pub new_platform_authority: Signer<'info>, #[account(mut, seeds = [b"circuit-config"], bump = config.bump, has_one = admin_authority @ DropsError::UnauthorizedAdmin, constraint = config.version == POLICY_VERSION @ DropsError::UnsupportedPolicy)] pub config: Account<'info, CircuitConfig>,} #[derive(Accounts)]pub struct TransferAdminAuthority<'info> {- Line 139
#[account(init, payer = upgrade_authority, space = 8 + CircuitConfig::INIT_SPACE,: Creates and pays for a new account. Space and payer must be specified. - Line 140
seeds = [b"circuit-config"], bump)]: Declares the PDA seeds. Anchor re-derives the address and rejects the account if it doesn't match. - Line 140
seeds = [b"circuit-config"], bump)]: Uses the bump seed, the extra byte that pushes the derived address off the ed25519 curve. - Line 147
pub admin_authority: Signer<'info>,: Requires this account to have signed the transaction. - Line 150
has_one = admin_authority @ DropsError::UnauthorizedAdmin,: Checks that a stored pubkey field matches the passed account.
scripts/create-drop.ts L37–59 @ 3004e0f · MIT · original { name: "drop_id", type: "string" }, { name: "active", type: "bool" }, { name: "bump", type: "u8" }, ], }, }], errors: [],}; async function main() { const keypairPath = path.join(os.homedir(), ".config", "solana", "id.json"); const secretKey = Uint8Array.from(JSON.parse(fs.readFileSync(keypairPath, "utf-8"))); const connection = new Connection(clusterApiUrl("devnet"), "confirmed"); const wallet = new anchor.Wallet(anchor.web3.Keypair.fromSecretKey(secretKey)); const provider = new anchor.AnchorProvider(connection, wallet, { commitment: "confirmed" }); const program = new anchor.Program(IDL as anchor.Idl, provider); const [dropPda] = PublicKey.findProgramAddressSync( [Buffer.from("drop"), Buffer.from(DROP_ID)], PROGRAM_ID );- Line 39
{ name: "bump", type: "u8" },: Uses the bump seed, the extra byte that pushes the derived address off the ed25519 curve. - Line 56
const [dropPda] = PublicKey.findProgramAddressSync(: Derives a PDA from seeds and the program ID and returns the address with its canonical bump.
How to run, build and test
These commands come from the repo's own manifests (package.json scripts, Anchor.toml, Cargo, go.mod, Makefile). Check the README for prerequisites and environment variables.
| Directory | Command | Runs |
|---|---|---|
. | npm run lint | prettier */*.js "*/**/*{.js,.ts}" --check |
backend | npm run dev | node --watch src/server.js |
backend | npm run start | node src/server.js |
app | npm run dev | next dev |
app | npm run start | next start |
app | npm run build | next build |
app | npm run lint | eslint |
tests/escrow | npm run test | node escrow-litesvm.cjs |
. | anchor build | compile programs and generate IDLs |
. | anchor test | local validator + test suite |
. | anchor run test | node scripts/test-batch-initialization.cjs |
. | cargo build | Rust workspace build |
. | cargo test | Rust tests |
What you could build from it
- Fork the SuperStack copy and extend it within the Payments gaps listed on the idea page.
- Learn the pattern first: SPL Tokens: mints, accounts and transfers
- Learn the pattern first: Blinks and Solana Actions
- Learn the pattern first: Building and sending transactions from a client