- Node.js 18 or newer
- npm, pnpm, or yarn
npm install trivaimport { build } from 'triva';
const app = new build({ env: 'development' });
app.get('/', (req, res) => {
res.send('Triva is installed');
});
app.listen(3000);Run the file and open http://localhost:3000.
Install only the packages you need:
npm install @trivajs/cors
npm install @triva/jwt
npm install @trivajs/cli
npm install @trivajs/shortcutsSome cache adapters need their own driver package in your app:
- Redis
- MongoDB
- PostgreSQL
- MySQL
- SQLite
- Better-SQLite3
- Supabase
Start with the adapter overview before wiring one into cache.
If you run Triva with protocol: 'https', provide ssl.key and ssl.cert:
import fs from 'fs';
import { build } from 'triva';
const app = new build({
protocol: 'https',
ssl: {
key: fs.readFileSync('./certs/localhost-key.pem'),
cert: fs.readFileSync('./certs/localhost-cert.pem')
}
});