Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
create-ejsx-app
Advanced tools
Create a production-ready Hono & EJSX app with authentication and dashboard
Create production-ready Hono & EJSX applications with zero configuration. Comes with built-in authentication, dashboard, and database setup.
npx create-ejsx-app my-app
cd my-app
npm run dev
bunx create-ejsx-app my-app
cd my-app
bun run dev
Visit http://localhost:3000
to see your app.
my-app/
├── src/
│ ├── routes/
│ │ ├── api.js # API routes (auth, user)
│ │ └── pages.js # Page routes with EJSX templates
│ ├── middleware/
│ │ ├── auth.js # JWT authentication
│ │ └── error.js # Error handling
│ ├── db/
│ │ └── setup.js # Database initialization
│ └── index.js # App entry point
├── data/ # SQLite database file
├── .env # Environment variables
├── .gitignore
└── package.json
# Start development server with hot reload
npm run dev
# Start production server
npm start
# Run tests
npm test
# Run linter
npm run lint
Create a .env
file in your project root:
NODE_ENV=development
PORT=3000
JWT_SECRET=your-secret-key
DATABASE_URL=./data/app.db
# Register new user
POST /api/auth/register
{
"email": "user@example.com",
"password": "password123",
"name": "John Doe"
}
# Login
POST /api/auth/login
{
"email": "user@example.com",
"password": "password123"
}
# Get user profile
GET /api/user
Authorization: Bearer <token>
/
- Home page/login
- Login page/dashboard
- Protected dashboard// src/routes/pages.js
ejsx.components.set('Button', ({ text, onClick, type = 'primary' }) => `
<button
class="bg-${type}-500 px-4 py-2 rounded"
onclick="${onClick}"
>
${text}
</button>
`);
// src/routes/api.js
api.get('/custom-route', async (c) => {
const userId = c.get('jwtPayload').sub;
// Your logic here
return c.json({ data: 'your data' });
});
// src/routes/pages.js
pages.get('/custom-page', async (c) => {
const html = await ejsx.render(`
<% slots.title = 'Custom Page' %>
<% slots.content = \`
<div>
<h1>Custom Page</h1>
<!-- Your content here -->
</div>
\` %>
<%- renderLayout('main', slots) %>
`, {});
return c.html(html);
});
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
FAQs
Create a production-ready Hono & EJSX app with authentication and dashboard
The npm package create-ejsx-app receives a total of 28 weekly downloads. As such, create-ejsx-app popularity was classified as not popular.
We found that create-ejsx-app demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.