Skip to content
impulseDOCS
Get Started

Build with Node.js

Create a project (quickstart), open the Connect tab, and copy your .env. Then wire it up:

Terminal window
npm install hono @hono/node-server postgres ioredis @aws-sdk/client-s3 jose
import { Hono } from 'hono';
import postgres from 'postgres';
import Redis from 'ioredis';
import { createRemoteJWKSet, jwtVerify } from 'jose';
const sql = postgres(process.env.DATABASE_URL!, { ssl: 'require' });
const redis = new Redis(process.env.REDIS_URL!);
const jwks = createRemoteJWKSet(new URL(`${process.env.AUTH_URL}/.well-known/jwks.json`));
const app = new Hono();
// Auth middleware — verify ImpulseAuth JWTs
app.use('/api/*', async (c, next) => {
const token = c.req.header('Authorization')?.replace('Bearer ', '');
if (!token) return c.text('unauthorized', 401);
const { payload } = await jwtVerify(token, jwks);
c.set('userId', payload.sub);
await next();
});
app.get('/api/todos', async (c) => {
const cached = await redis.get(`todos:${c.get('userId')}`);
if (cached) return c.json(JSON.parse(cached));
const todos = await sql`select * from todos where user_id = ${c.get('userId')}`;
await redis.set(`todos:${c.get('userId')}`, JSON.stringify(todos), 'EX', 30);
return c.json(todos);
});

Publish jobs to ImpulseMessaging and consume them in a worker process — same .env, second systemd unit.

A Cloud VPS with systemd + Nginx is the natural home: node server.js under a unit file, TLS at the proxy. Deploy with git pull or rsync from CI.