npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

atomikjs

v1.0.45

Published

Ultra-fast and lightweight web framework for Node.js

Readme

⚛️ Atomik

An ultra-fast and lightweight web framework for Node.js, inspired by simplicity and performance.

npm version License: MIT

Quick start

pnpm create atomikjs <projectName>
import { Atomik } from 'atomikjs';

const app = new Atomik();

app.get('/', c => {
	return c.text('Hello, Atomik! 🚀');
});

export default app;

// Server starts automatically on port 5656

🌟 Features

  • Ultra-fast - Built with performance in mind
  • 🪶 Lightweight - Minimal with no heavy dependencies
  • 🔧 Simple - Intuitive and easy-to-use API
  • 🛣️ Routing - Built-in routing system
  • 🔌 Middleware - Full middleware support
  • 📦 TypeScript - Native TypeScript support
  • 🎯 Context API - Rich context for requests/responses
  • 🕹️ Multi-runtime - Works on Cloudflare, Fastly, Deno, Bun, AWS, or Node.js. The same code runs on all platforms

🚀 Installation

# npm
npm install atomikjs

# pnpm
pnpm add atomikjs

# yarn
yarn add atomikjs

📖 Quick Start Guide

Basic Application

import { Atomik } from 'atomikjs';

const app = new Atomik();

app.get('/', c => {
	return c.text('Welcome to Atomik!');
});

app.post('/api/users', c => {
	return c.json({ message: 'User created' });
});

app.get('/html', c => {
	return c.html('<h1>Hello HTML!</h1>');
});

export default app;

Supported HTTP Methods

app.get('/users', c => c.json({ users: [] }));
app.post('/users', c => c.json({ created: true }));
app.put('/users/:id', c => c.json({ updated: true }));
app.delete('/users/:id', c => c.json({ deleted: true }));
app.patch('/users/:id', c => c.json({ patched: true }));
app.options('/users', c => c.set('x-header', 'preload').status(204).json({})); // empty json call signature to validate the request
app.head('/head', c => c.set('x-header', 'preload').status(204).json({})); // empty json call signature to validate the request
app.all('/all', c => c.json({ ok: true }));

Middleware

import { Atomik } from 'atomikjs';

const app = new Atomik();

// Logging middleware

// NOTE: When you use an explicit path in middleware, it's not just the exact path that's intercepted, it's the exact path and the entire route below it.
// ----- (e.g.) app.use("/post") --> captured routes: /post/*

// with implicit routing (*)
app.use((c, next) => {
	console.log(`${c.method} ${c.url}`);
	next();
});

// with explicit routing
app.use('*', (c, next) => {
	console.log(c.method, c.url);
	next();
});

// on specific route
app.use('/post/user', (c, next) => {
	// captured routes: /post/user/*
	console.log('From /post/user base url');
	next();
});

// CORS middleware
app.use(cors());

app.get('/', c => c.text('Hello with middleware!'));

export default app;

Group Routing

import { Atomik } from 'atomikjs';

const api = new Atomik();
// CORS middleware
api.use(cors());

api.get('/posts', c => c.json({ posts: ['all posts'] }));

api.get('/posts/:id', c => {
	const id = c.params.id;
	return c.json({
		postId: id,
	});
});

api.post('/posts/:id', c => {
	const id = c.params.id;
	const db = []; // fake db

	db.push(id);

	return c.json({
		ok: true,
		newDb: db,
	});
});

const status = new Atomik();

status.get('/current', c => c.json({ current: 'operational' }));

const app = new Atomik();
app.route('/api', api); // every routes of api router are now based on /api ==> (api router) /posts/:id -> (app router) /api/posts/:id
app.route('/status', status); // same things here ==> (status router) /current -> (app router) /status/current

export default app; // Accessible routes are only those of the exported router. You will not be able to access other routes if they are not connected to the router exported by app.route()

Set a base path

import { Atomik } from 'atomikjs';

const app = new Atomik().basePath('/api');

app.get('/test', c => {
	return c.json({
		message: 'endpoint /test with custom basePath',
	});
});

export default app;

Base path with route group routing

import { Atomik } from 'atomikjs';

const api = new Atomik().basePath('/api');

api.get('/test', c => {
	// /api/test
	return c.json({
		message: 'endpoint /test with custom basePath',
	});
});

const status = new Atomik();

status.get('/test', c => {
	// /test
	return c.json({
		message: 'test',
	});
});

const test = new Atomik();

test.get('/test', c => {
	// /v1/test
	return c.json({
		message: 'from /test',
	});
});

const app = new Atomik();

app.route('/', status);
app.route('/', api);
app.route('/v1', test);

export default app;

Context API

The context (c) provides useful methods for handling requests and responses:

app.get('/api/demo/:id', c => {
	// Text response
	return c.text('Hello World');

	// JSON response
	return c.json({ message: 'Hello', status: 'success' });

	// HTML response
	return c.html('<h1>Hello HTML</h1>');

	// Set header
	return c.set('x-header', 'header-content').json({ customHeader: true });

	// Send
	return c.send('text'); // string <=> c.text("text")
	return c.send({ data: [] }); // json <=> c.json({ data: [] })

	// Set status
	return c.status(201).json({ created: true });

	// Redirect
	return c.redirect('/other-page');

	// Access query parameters
	const name = c.query.get('name');
	return c.text(`Hello ${name}`);

	// Access url params
	const id = c.params.id;
	return c.text(`Hello id: ${id}`);
});

export default app;

⚠️ Warning

Make sure to always return a response in all your endpoints

Common errors

// in Edge environement
app.get('/', c => c.json({ ok: true })); // ✅ implicit handler --> auto retrun
app.get('/', c => {
	return c.json({ ok: true }); // ✅ explicit handler --> manual return
});
app.get('/', c => {
	c.json({ ok: true }); // ❌ explicit handler without return --> null body in edge env
});

// in nodejs environement
app.get('/', c => c.json({ ok: true })); // ✅
app.get('/', c => {
	return c.json({ ok: true }); // ✅
});
app.get('/', c => {
	c.json({ ok: true }); // ✅
});

🏗️ Architecture

Atomik is built around three main concepts:

  • Router: Route and HTTP method management
  • Context: Rich interface for requests/responses
  • Server: Optimized HTTP server

🔧 Advanced Configuration

Nodejs runtime

import { Atomik, serve, cors } from '../index';

const app = new Atomik();

app.get('/', c => c.text('Custom server'));

serve({ app: app, port: 3476 });

📊 Performance

Atomik is designed to be one of the fastest frameworks:

  • Optimized routing
  • Low overhead
  • Efficient URL parsing
  • Optimized memory management

🤝 Comparison with Other Frameworks

| Feature | Atomik | Express | Fastify | Hono | | ----------------- | ------ | ------- | ------- | ------ | | Native TypeScript | ✅ | ❌ | ✅ | ✅ | | Size (gzipped) | ~2KB | ~15KB | ~8KB | ~3KB | | Performance | ⚡⚡⚡ | ⚡ | ⚡⚡ | ⚡⚡⚡ | | Modern API | ✅ | ❌ | ✅ | ✅ |

🛠️ Development

# Clone the repo
git clone https://github.com/valogzi/atomik.git
cd atomik

# Install dependencies
pnpm install

# Development
pnpm dev

# Build
pnpm build

📝 Examples

Check the examples/ folder for complete examples.

🤝 Contributing

Contributions are welcome! Check our contribution guide.

📄 License

MIT © Valogzi

🙏 Acknowledgments

Inspired by the excellent architecture of Hono and optimized for Node.js.