Example demonstrating the Unchained Engine ticketing extension for event tickets and digital passes.
- Fastify HTTP server with custom Unchained logger
- Base plugins via
@unchainedshop/plugins/presets/base - Ticketing module with
@unchainedshop/ticketing - PDF ticket rendering (placeholder implementation)
- Apple Wallet pass generation (placeholder implementation)
- Google Wallet pass generation (placeholder implementation)
- Magic key order access for ticket retrieval without login
- Database seeding with admin user, country, currency, language, and providers
- Integration tests for ticketing functionality
- Node.js >= 22
- MongoDB (or uses in-memory MongoDB for development)
npm install
npm run devServer starts at http://localhost:4010 with:
- GraphQL endpoint:
/graphql - Default login:
admin@unchained.local/password
| Command | Description |
|---|---|
npm run dev |
Start development server with watch mode |
npm run build |
Build TypeScript to lib/ |
npm start |
Start production server |
npm run test:run:integration |
Run integration tests |
npm run lint |
Format code with Prettier |
| Variable | Description | Default |
|---|---|---|
ROOT_URL |
Public URL of the server | http://localhost:4010 |
PORT |
Server port | 4010 |
UNCHAINED_TOKEN_SECRET |
Secret for session tokens (min 32 chars) | - |
UNCHAINED_SECRET |
Secret for magic key encryption | secret |
EMAIL_FROM |
Default sender email | noreply@unchained.local |
EMAIL_WEBSITE_NAME |
Website name for emails | Unchained |
EMAIL_WEBSITE_URL |
Website URL for emails | http://localhost:4010 |
| Variable | Description | Default |
|---|---|---|
UNCHAINED_SEED_PASSWORD |
Admin password (generate for random) |
password |
UNCHAINED_COUNTRY |
Default country ISO code | CH |
UNCHAINED_CURRENCY |
Default currency ISO code | CHF |
UNCHAINED_LANG |
Default language ISO code | de |
| Variable | Description |
|---|---|
PASS_CERTIFICATE_PATH |
Path to Apple pass certificate (PEM) |
PASS_CERTIFICATE_SECRET |
PEM passphrase |
PASS_TEAM_ID |
Apple Developer Team ID |
The example includes placeholder implementations for ticket rendering:
setupTicketing(platform.unchainedAPI, {
renderOrderPDF: () => { /* Implement PDF generation */ },
createAppleWalletPass: () => { /* Implement Apple Wallet pass */ },
createGoogleWalletPass: () => { /* Implement Google Wallet pass */ },
});import ReactPDF from '@react-pdf/renderer';
const renderOrderPDF = async ({ orderId }, { modules }) => {
const order = await modules.orders.findOrder({ orderId });
return ReactPDF.renderToStream(<TicketDocument order={order} />);
};See the @unchainedshop/ticketing documentation for detailed implementation guides.
On first start, the seed script creates:
- Admin user:
admin@unchained.local - Country: Switzerland (CH)
- Currency: Swiss Franc (CHF)
- Language: German (de)
- Delivery provider: Send Message
- Payment provider: Invoice
Run integration tests:
npm run test:run:integrationTests are located in the tests/ directory.
docker build -t unchained-ticketing .
docker run -p 4010:4010 unchained-ticketingEUPL-1.2