Your README is the front door of your project. It’s the first thing visitors see on GitHub, and it determines whether someone will use your library, contribute to your project, or move on. A great README can be the difference between 10 stars and 10,000.

This guide teaches you how to write a README that makes people want to use your project.

Why Your README Matters

  • 92% of developers check the README before using a package
  • GitHub ranks projects with better documentation higher in search
  • Contributors are 3x more likely to contribute to well-documented projects
  • A clear README reduces support issues by answering questions upfront

The Perfect README Structure

Every great README follows this pattern:

# Project Name

One-sentence description of what this project does.

## Features
## Installation
## Usage
## API Reference (if applicable)
## Contributing
## License

Let’s break down each section.

1. Project Header

Title and Description

# 🚀 FastCache

A blazing-fast, zero-dependency in-memory cache for Node.js
with automatic TTL expiration and LRU eviction.

Tips:

  • Use a clear, memorable project name
  • One sentence that answers: “What does this do?”
  • Include an emoji for visual appeal (optional)

Badges

Add status badges right below the description:

[![npm version](https://img.shields.io/npm/v/fastcache)](https://npmjs.com/package/fastcache)
[![Build Status](https://img.shields.io/github/actions/workflow/status/user/fastcache/ci.yml)](https://github.com/user/fastcache/actions)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Downloads](https://img.shields.io/npm/dm/fastcache)](https://npmjs.com/package/fastcache)

Common badges: build status, version, license, downloads, coverage, code quality.

Hero Image or Demo

If your project has a UI, show it:

![FastCache Demo](./docs/demo.gif)

A single screenshot or GIF is worth a thousand words of documentation.

2. Features Section

List what makes your project special:

## ✨ Features

-**Blazing fast** — O(1) get/set operations
- 🔄 **Automatic TTL** — entries expire after configurable duration
- 📊 **LRU eviction** — least recently used items removed when cache is full
- 🔒 **Thread-safe** — safe for concurrent access
- 📦 **Zero dependencies** — no bloat, no supply chain risk
- 🧪 **100% test coverage** — reliable and battle-tested

Tips:

  • Use emoji for visual scanning
  • Bold the key phrase in each item
  • Keep each item to one line
  • Limit to 5-8 features (highlight the best ones)

3. Installation

Make it copy-pasteable:

## 📦 Installation

\`\`\`bash
# npm
npm install fastcache

# yarn
yarn add fastcache

# pnpm
pnpm add fastcache
\`\`\`

### Requirements
- Node.js >= 18.0
- No additional dependencies

Tips:

  • Include all package managers your audience uses
  • List requirements and prerequisites
  • Keep it to 1-2 commands maximum

4. Quick Start / Usage

Show the simplest possible example first:

## 🚀 Quick Start

\`\`\`javascript
import { Cache } from 'fastcache';

// Create a cache with 5-minute TTL
const cache = new Cache({ ttl: 300 });

// Set a value
cache.set('user:123', { name: 'Alice', role: 'admin' });

// Get a value
const user = cache.get('user:123');
console.log(user.name); // 'Alice'
\`\`\`

Then show more advanced examples:

### Advanced Usage

\`\`\`javascript
// LRU cache with max 1000 items
const lruCache = new Cache({
  maxSize: 1000,
  ttl: 600,
  onEvict: (key, value) => {
    console.log(`Evicted: ${key}`);
  }
});

// Check if key exists
if (cache.has('user:123')) {
  // ...
}

// Delete a key
cache.delete('user:123');

// Clear all entries
cache.clear();
\`\`\`

5. API Reference

For libraries, document every public method:

## 📖 API Reference

### `new Cache(options)`

| Option | Type | Default | Description |
|:-------|:-----|:--------|:------------|
| `ttl` | `number` | `0` | Time-to-live in seconds (0 = no expiration) |
| `maxSize` | `number` | `Infinity` | Maximum number of entries |
| `onEvict` | `function` | `undefined` | Callback when entry is evicted |

### `cache.set(key, value)`
Stores a value. Returns `this` for chaining.

### `cache.get(key)`
Retrieves a value. Returns `undefined` if not found or expired.

### `cache.has(key)`
Returns `true` if the key exists and hasn't expired.

### `cache.delete(key)`
Removes an entry. Returns `true` if the key existed.

### `cache.clear()`
Removes all entries.

### `cache.size`
Returns the number of entries in the cache.

6. Architecture (For Complex Projects)

Use Mermaid diagrams to explain architecture:

## 🏗️ Architecture

```mermaid
graph TD
    A[Client Request] --> B[Cache Layer]
    B --> C{Cache Hit?}
    C -->|Yes| D[Return Cached Data]
    C -->|No| E[Database Query]
    E --> F[Store in Cache]
    F --> D
```

7. Contributing

Welcome contributors with clear guidelines:

## 🤝 Contributing

Contributions are welcome! Please read our
[Contributing Guide](CONTRIBUTING.md) before submitting a PR.

1. Fork the repository
2. Create your feature branch (`git checkout -b feature/amazing`)
3. Commit your changes (`git commit -m 'Add amazing feature'`)
4. Push to the branch (`git push origin feature/amazing`)
5. Open a Pull Request

8. License

Always include a license:

## 📄 License

This project is licensed under the MIT License — see the
[LICENSE](LICENSE) file for details.

Complete README Template

Here’s a copy-paste template you can use for any project:

# 📦 Project Name

Brief description of what this project does and who it's for.

![Build Status](badge-url) ![License](badge-url) ![Version](badge-url)

## ✨ Features

- ⚡ Feature one with brief description
- 🔄 Feature two with brief description
- 📊 Feature three with brief description

## 📦 Installation

\`\`\`bash
npm install project-name
\`\`\`

## 🚀 Quick Start

\`\`\`javascript
import { Main } from 'project-name';
const result = Main.doSomething();
\`\`\`

## 📖 API Reference

### `method(param)`
Description of what this method does.

| Param | Type | Description |
|:------|:-----|:------------|
| `param` | `string` | What this parameter does |

## 🤝 Contributing

Contributions welcome! See [CONTRIBUTING.md](CONTRIBUTING.md).

## 📄 License

MIT © [Your Name](https://yoursite.com)

README Anti-Patterns

❌ Don’t: Wall of Text

Nobody reads paragraphs in a README. Use headers, lists, and code blocks.

❌ Don’t: Skip the Install Step

Never assume people know how to install your project.

❌ Don’t: Missing Usage Examples

“See the docs” is not a usage example. Show real code.

❌ Don’t: Outdated Information

A README with wrong instructions is worse than no README.

❌ Don’t: No License

Without a license, your code is legally unusable by others.

Viewing READMEs on Android

After writing your README, you’ll want to preview how it looks — especially Mermaid diagrams, tables, and badges. MerMD lets you:

  • Open README files directly from GitHub repositories
  • Preview with full GFM rendering — tables, task lists, badges
  • View Mermaid architecture diagrams natively
  • Read offline after first open
  • Test on a mobile viewport — important since many users browse GitHub on phones

Frequently Asked Questions

What file format should my README be? Use README.md (Markdown). GitHub automatically renders it on your repository’s main page.

How long should a README be? Long enough to answer “What is this?”, “How do I use it?”, and “How do I contribute?” — typically 200-500 lines.

Should I include screenshots? Yes, especially for UI projects. A single screenshot or GIF dramatically increases engagement.

What about a table of contents? For READMEs longer than 500 lines, add a TOC. For shorter ones, headings are sufficient for navigation.

Preview Your README on Android

See exactly how your README will look — with Mermaid diagrams, tables, and badges rendered beautifully. Free on Google Play.

Download MerMD