Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
platformatic
Advanced tools
Platformatic is a versatile npm package designed to simplify the development of modern web applications. It provides a suite of tools and features that streamline the process of building, deploying, and managing web services and APIs.
API Development
This feature allows developers to quickly set up and manage API endpoints. The code sample demonstrates how to create a simple server with a single GET endpoint that returns a 'Hello, world!' message.
const { createServer } = require('platformatic');
const server = createServer({
routes: [
{
method: 'GET',
url: '/hello',
handler: async (request, reply) => {
return { message: 'Hello, world!' };
}
}
]
});
server.listen(3000, (err) => {
if (err) {
console.error('Error starting server:', err);
} else {
console.log('Server listening on port 3000');
}
});
Database Integration
Platformatic provides seamless database integration, allowing developers to connect to and query databases easily. The code sample shows how to set up a route that fetches data from a 'users' table in a database.
const { createServer } = require('platformatic');
const { connect } = require('platformatic-db');
const server = createServer({
routes: [
{
method: 'GET',
url: '/users',
handler: async (request, reply) => {
const db = await connect();
const users = await db.query('SELECT * FROM users');
return users;
}
}
]
});
server.listen(3000, (err) => {
if (err) {
console.error('Error starting server:', err);
} else {
console.log('Server listening on port 3000');
}
});
Authentication
Platformatic includes built-in authentication mechanisms to secure endpoints. The code sample demonstrates how to protect a route using an authentication middleware.
const { createServer } = require('platformatic');
const { authenticate } = require('platformatic-auth');
const server = createServer({
routes: [
{
method: 'GET',
url: '/secure',
preHandler: authenticate,
handler: async (request, reply) => {
return { message: 'This is a secure endpoint' };
}
}
]
});
server.listen(3000, (err) => {
if (err) {
console.error('Error starting server:', err);
} else {
console.log('Server listening on port 3000');
}
});
Express is a minimal and flexible Node.js web application framework that provides a robust set of features for web and mobile applications. Compared to Platformatic, Express is more lightweight and requires additional middleware for features like authentication and database integration.
Hapi is a rich framework for building applications and services. It is known for its powerful plugin system and configuration-based approach. Hapi offers more built-in features compared to Express but may have a steeper learning curve compared to Platformatic.
NestJS is a progressive Node.js framework for building efficient, reliable, and scalable server-side applications. It uses TypeScript by default and is heavily inspired by Angular. NestJS provides a more structured and opinionated approach compared to Platformatic.
Platformatic is a set a Open Source tools that you can use to build your own Internal Developer Platform.
The first of these tools is Platformatic DB — more will follow!
npm install platformatic
# Start a new project
npx platformatic db init
Follow our Quick Start Guide guide to get up and running with Platformatic DB.
Check out our full documentation at oss.platformatic.dev.
Having issues? Drop in to the Platformatic Discord for help.
Apache 2.0
FAQs
Platformatic CLI
The npm package platformatic receives a total of 682,456 weekly downloads. As such, platformatic popularity was classified as popular.
We found that platformatic demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 8 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
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.