Get your demo running in under 5 minutes!
cd backend/dna-integrator
./run-dev.bat # Windows
# or
./run-dev.sh # Linux/MacWhat happens:
- Backend starts on http://localhost:8081
- Demo mode is automatically enabled
- Three demo users are auto-created:
demo/demo123(USER)admin/admin123(ADMIN)moderator/mod123(MODERATOR)
Open your browser and visit:
http://localhost:8081/api/demo/status
You should see:
{
"enabled": true,
"message": "DEMO MODE ACTIVE - For development and testing only",
"demoUsers": {
"demo": { "username": "demo", "password": "demo123", "role": "USER" },
"admin": { "username": "admin", "password": "admin123", "role": "ADMIN" },
"moderator": { "username": "moderator", "password": "mod123", "role": "MODERATOR" }
}
}-
Open Swagger: http://localhost:8081/swagger-ui.html
-
Find Demo Mode section (scroll down)
-
Try Quick Login:
- Expand
POST /api/demo/login-demo-user - Click "Try it out"
- Enter:
{ "username": "demo", "password": "demo123" } - Click "Execute"
- Copy the JWT token from the response
- Expand
-
Authorize with the token:
- Click the "Authorize" button (top of page)
- Paste your token
- Click "Authorize"
-
Try uploading data:
- Find
POST /api/data/upload/vcf - Upload
backend/sample-data/sample.vcf - Set userId to "demo"
- Execute!
- Find
- Add demo mode detection to your login page:
// Check if demo mode is available
fetch('http://localhost:8081/api/demo/status')
.then(res => res.json())
.then(data => {
if (data.enabled) {
console.log('Demo mode active!');
console.log('Demo users:', data.demoUsers);
}
});- Add quick login button:
<button onClick={async () => {
const response = await fetch('http://localhost:8081/api/demo/login-demo-user', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ username: 'demo', password: 'demo123' })
});
const data = await response.json();
localStorage.setItem('token', data.token);
window.location.href = '/dashboard';
}}>
Quick Login (Demo)
</button>- Add quick registration:
<button onClick={async () => {
const response = await fetch('http://localhost:8081/api/demo/quick-register', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
username: 'myuser',
password: 'pass123'
})
});
const data = await response.json();
localStorage.setItem('token', data.token);
window.location.href = '/dashboard';
}}>
Quick Register (Demo)
</button># 1. Quick login
curl -X POST http://localhost:8081/api/demo/login-demo-user \
-H "Content-Type: application/json" \
-d '{"username":"demo","password":"demo123"}'
# 2. Copy the token from the response
# 3. Use the token to upload data
TOKEN="your_token_here"
curl -X POST http://localhost:8081/api/data/upload/vcf \
-H "Authorization: Bearer $TOKEN" \
-F "file=@backend/sample-data/sample.vcf" \
-F "userId=demo"Goal: Show the app to stakeholders
- Start backend:
./run-dev.bat - Open Swagger UI: http://localhost:8081/swagger-ui.html
- Login as admin:
admin/admin123 - Show data upload feature
- Show different user roles (demo, moderator, admin)
Goal: Test frontend without complex registration
- Start backend in dev mode
- Check demo mode:
GET /api/demo/status - Use quick register to create test users on-the-fly
- Test different user flows
Goal: Test new features quickly
- Login as demo user:
demo/demo123 - Or create new user: Quick register with any username
- Test your feature
- Restart backend to reset data (H2 in-memory)
- Add demo mode detection on app load
- Show demo mode banner when enabled
- Add "Quick Login" buttons for demo users
- Add "Quick Register" option
- Hide demo features when demo mode is disabled
- Store JWT token after login/registration
- Redirect to dashboard after successful auth
import { useState, useEffect } from 'react';
function App() {
const [demoMode, setDemoMode] = useState(false);
const [demoUsers, setDemoUsers] = useState(null);
useEffect(() => {
// Check demo mode on load
fetch('http://localhost:8081/api/demo/status')
.then(res => res.json())
.then(data => {
setDemoMode(data.enabled);
setDemoUsers(data.demoUsers);
});
}, []);
const quickLogin = async (username, password) => {
const response = await fetch('http://localhost:8081/api/demo/login-demo-user', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ username, password })
});
const data = await response.json();
localStorage.setItem('token', data.token);
// Redirect to dashboard
};
return (
<div>
{demoMode && (
<div className="demo-banner">
<h3>Demo Mode Active</h3>
{demoUsers && Object.values(demoUsers).map(user => (
<button
key={user.username}
onClick={() => quickLogin(user.username, user.password)}
>
Login as {user.username}
</button>
))}
</div>
)}
{/* Rest of your app */}
</div>
);
}IMPORTANT: Demo mode is automatically disabled in production!
When you deploy:
- Use production profile:
--spring.profiles.active=prod - Demo mode will be disabled automatically
- All demo endpoints return 403 Forbidden
- Frontend should hide demo UI (check
enabled: false)
Verify in production:
curl https://your-production-url/api/demo/status
# Should return: { "enabled": false }- Comprehensive Guide: See
DEMO-MODE-GUIDE.md - Frontend Integration: See
frontend/DEMO-MODE-INTEGRATION.md - API Documentation: Visit http://localhost:8081/swagger-ui.html
- All API Examples: See
backend/API-EXAMPLES.md
Demo mode gives you:
- Pre-created users for instant testing
- Quick registration from your GUI
- Easy detection via status endpoint
- Auto-disabled in production
- Zero configuration needed
You're ready to demo!