JavaScript SDK
The JavaScript SDK provides a typed client for all Foundry API endpoints.
Installation
Section titled “Installation”npm install @saas-maker/sdkimport { SaaSMakerClient } from '@saas-maker/sdk';
const client = new SaaSMakerClient({ apiKey: 'pk_your_api_key', baseUrl: 'https://api.sassmaker.com',});For dashboard surfaces (admin operations), pass a sessionToken instead:
const dashboardClient = new SaaSMakerClient({ sessionToken: 'sm_your_session_token', baseUrl: 'https://api.sassmaker.com',});Feedback
Section titled “Feedback”// Submit feedbackawait client.feedback.submit({ title: 'Add dark mode', description: 'Would love a dark mode option', type: 'feature', submitter_email: 'user@example.com',});
// List feedbackconst { data, total } = await client.feedback.list({ type: 'feature', sort: 'upvotes', page: 1,});Waitlist
Section titled “Waitlist”// Add to waitlistconst entry = await client.waitlist.join({ email: 'user@example.com', name: 'Jane Doe',});
// Get total countconst { count } = await client.waitlist.getCount();Testimonials
Section titled “Testimonials”// Submit a testimonialawait client.testimonials.submit({ author_name: 'Jane Doe', author_email: 'jane@example.com', content: 'Foundry saved us weeks.', rating: 5, author_title: 'CTO at Acme',});
// List approved testimonialsconst testimonials = await client.testimonials.list();Changelog
Section titled “Changelog”// List published entriesconst entries = await client.changelog.list();Analytics
Section titled “Analytics”// Track an eventawait client.analytics.track({ name: 'page_view', url: 'https://myapp.com/pricing',});Roadmap
Section titled “Roadmap”// List public roadmap itemsconst items = await client.roadmap.listPublic('my-project-slug');
// Vote on a roadmap itemawait client.roadmap.vote('my-project-slug', 'item_123', { user_identifier: 'user@example.com',});
// Remove a voteawait client.roadmap.removeVote('my-project-slug', 'item_123', 'user@example.com');Projects
Section titled “Projects”// Get project README (API key auth)const { readme } = await client.projects.getReadme();
// Update project READMEawait client.projects.updateReadme('# My Project\n\nWelcome!');Error handling
Section titled “Error handling”All methods throw on non-2xx responses. Errors include the message field from the API:
try { await client.feedback.submit({ ... });} catch (err) { console.error(err.message); // "Title is required"}