cAPIta - Capitalization API
A blazing-fast REST API for text transformation. Convert any string to 29 different styles including camelCase, snake_case, kebab-case, and more! Powered by capstring.
- 29 capitalization styles - More than any other text transform API!
- Multiple output formats - JSON, JSONP, HTML, TXT, XML, YAML, CSV
- Built-in spell check - Powered by nspell (no API key required!)
- Batch processing - Transform up to 100 strings at once
- Chain transformations - Apply multiple styles in sequence
- Word/char count - Built-in text analytics
- Lorem ipsum generator - Generate placeholder text
- XSS-safe HTML output - Security built in
- Content negotiation - Automatic format based on Accept header
# Install
npm install capita
# Start the server
npm start
# Try it out!
curl http://localhost:4321/title/hello%20world.json
# {"input":"hello world","output":"Hello World","cap":"title"}
# See all available styles
curl http://localhost:4321/stylesGET /:style/:string
GET /:style/:string.:ext
GET /chain/:styles/:string
Chain styles with +:
curl http://localhost:4321/chain/upper+reverse/hello.json
# {"input":"hello","output":"OLLEH","cap":"upper+reverse"}
curl http://localhost:4321/chain/lower+title+kebab/HELLO%20WORLD.txt
# hello-worldPOST /batch
Transform multiple strings at once:
curl -X POST http://localhost:4321/batch \
-H "Content-Type: application/json" \
-d '{"inputs": ["hello", "world"], "style": "upper"}'
# {"style":"upper","results":[{"input":"hello","output":"HELLO"},{"input":"world","output":"WORLD"}],"count":2}GET /count/:string
GET /count/:string.:ext
curl http://localhost:4321/count/hello%20world.json
# {"input":"hello world","words":2,"characters":11,"charactersNoSpaces":10}GET /lorem/:count?
GET /lorem/:count?.:ext
curl http://localhost:4321/lorem/10.json
# {"lorem":"Lorem ipsum dolor sit amet consectetur adipiscing elit sed do.","wordCount":10}| Style | Input | Output |
|---|---|---|
upper |
hello world | HELLO WORLD |
lower |
HELLO WORLD | hello world |
title |
hello world | Hello World |
sentence |
hello world | Hello world |
swap |
Hello World | hELLO wORLD |
| Style | Input | Output |
|---|---|---|
camel |
hello world | helloWorld |
pascal |
hello world | HelloWorld |
snake |
hello world | hello_world |
kebab |
hello world | hello-world |
constant |
hello world | HELLO_WORLD |
dot |
hello world | hello.world |
path |
hello world | hello/world |
train |
hello world | Hello-World |
| Style | Input | Output |
|---|---|---|
leet |
elite | 3£1t3 |
reverse |
hello | olleh |
sponge |
hello | HeLlO |
hashtag |
hello world | #HelloWorld |
acronym |
as soon as possible | ASAP |
rot13 |
hello | uryyb |
flip |
hello | ollǝɥ |
| Extension | Content-Type | Example |
|---|---|---|
.json |
application/json | {"input":"hello","output":"HELLO","cap":"upper"} |
.jsonp |
application/javascript | Callback wrapper |
.html |
text/html | <em>HELLO</em> |
.txt |
text/plain | HELLO |
.xml |
application/xml | <result><output>HELLO</output></result> |
.yaml |
text/yaml | output: "HELLO" |
.csv |
text/csv | input,output,cap |
GET /spell/:string
GET /spell/:string.:ext
Uses nspell with the English Hunspell dictionary. No API key required!
curl http://localhost:4321/spell/helo%20wrld.json
# {"input":"helo wrld","output":"hello world","cap":"spell"}GET /badge/:style/:string
Returns an SVG badge via shields.io. Perfect for README files!
GET /styles
Returns all available styles and their count.
| Variable | Description | Default |
|---|---|---|
PORT |
Server port | 4321 |
- XSS Prevention - HTML output is escaped
- Input Limits - Max 10,000 characters per request
- Batch Limits - Max 100 items per batch request
- Chain Limits - Max 10 transformations per chain
- Fetch Timeout - 5 second timeout on badge requests
npm install # Install dependencies
npm start # Start server
npm run demo # Run interactive demo
npm test # Run tests
npm run lint # Run linter
npm run test:coverage # Test with coverage (84%+)Please read CONTRIBUTING.md for details on the process for submitting pull requests.
This project uses Semantic Versioning 2.0.
- capstring - The core library that powers cAPIta
- Node.js 18+
- ES modules (
import/export)
MIT