Railway
Deploy an app to Railway that sends your first email using the mailblastr SDK.
Railway lets you focus on building your product instead of managing infrastructure, scaling automatically as you grow. Use the mailblastr Node SDK — it works the same on Railway as in any Node.js host. Install it with npm install mailblastr.
Prerequisites
Before you start, you will need:
- A MailBlastr API key.
- A verified domain to send from.
- A Railway account.
1. Install the SDK
npm install mailblastr2. Create a Railway project
Create a new project on Railway and deploy a Node.js service (for example, from a GitHub repo or with railway init from the Railway CLI).
3. Add your API key
In your service's Variables tab, add MAILBLASTR_API_KEY with your key. Railway injects it into the runtime environment so you never commit the secret.
MAILBLASTR_API_KEY=mb_xxxxxxxxx4. Send your first email
In a request handler (here, a minimal Node.js HTTP server), instantiate the SDK client and call mb.emails.send().
import { createServer } from 'node:http';
import { MailBlastr } from 'mailblastr';
const mb = new MailBlastr(process.env.MAILBLASTR_API_KEY);
createServer(async (_req, res) => {
const { data, error } = await mb.emails.send({
from: 'Acme <onboarding@yourdomain.com>',
to: ['delivered@example.com'],
subject: 'hello world',
html: '<strong>it works!</strong>',
});
res.writeHead(error ? 500 : 200, { 'Content-Type': 'application/json' });
res.end(JSON.stringify(error ? { error } : { data }));
}).listen(process.env.PORT || 3000);5. Deploy and verify
Once your deployment finishes, open the deploy URL to send your first email.