Feature and Module Structure Tour
Understanding a feature (tool) in this repo How features are built and how new ones should fit in
Every tool is a self-contained feature. Let's walk through how one actually works using the JSON Formatter tool as an example:
What files make up a single feature
JSON Formatter tool uses:
├── app/components/developmentToolsComponent/
│ └── jsonPrittifierComponent.tsx (The actual tool component)
├── app/libs/
│ ├── developmentToolsConstant.tsx (Tool metadata & registration)
│ ├── helpers.tsx (Shared formatting utilities)
│ └── constants.tsx (Route definitions)
└── app/components/ui/ (Reusable UI: buttons, inputs, copy)1. The Tool Component
Open app/components/developmentToolsComponent/jsonPrittifierComponent.tsx. This is the entire feature—one file:
"use client";
import { Editor } from "@monaco-editor/react"; // Monaco editor for code
import { useState } from "react";
export default function JsonPrettifier() {
const [input, setInput] = useState("");
const [output, setOutput] = useState("");
const [error, setError] = useState("");
const handlePrettify = () => {
try {
const parsed = JSON.parse(input);
setOutput(JSON.stringify(parsed, null, 2));
setError("");
} catch (err) {
setError("Invalid JSON");
}
};
return (
<div>
<Editor value={input} onChange={setInput} />
<button onClick={handlePrettify}>Prettify</button>
<div>{output}</div>
</div>
);
}The pattern here is: Input → Process → Output
2. Tool Registration in Constants
Every tool is registered in app/libs/developmentToolsConstant.tsx. Here's what an entry looks like:
This configuration file does A LOT:
Defines the URL slug (
json-formatter)Sets page title and description (used for SEO)
Lists related tools shown on the page
Provides the step-by-step guide text
Contains the "about" section content
When you add a new tool, you're essentially just adding an entry here.
3. Route Registration
The route path is defined in app/libs/constants.tsx:
4. How the route actually works
The file app/[slug]/page.tsx handles ALL tool routes:
One file handles 170+ tools. The slug automatically maps to the config and the component.
Real Example: Adding a New Tool
Let's say you want to add a "YAML to JSON" converter:
Step 1: Create the component
Create app/components/developmentToolsComponent/yamlToJsonConverter.tsx:
Step 2: Register in constants
Add to constants.tsx:
Step 3: Register in tool config
Add to developmentToolsConstant.tsx:
That's it. The route /yaml-to-json automatically works. The component renders. The page has SEO metadata. Related tools appear below.
5. Shared UI Components
Your tool uses common UI from app/components/ui/:
Copy button component → handles copy-to-clipboard
Input field component → consistent styling
Error message component → standard error display
Loading spinner → async operations
You can build these yourself again, if not you can reuse existing ones.
Structure matters because:
Component file = one tool
Easy to find and modify
Config = separate from code
Change metadata without touching component logic
UI components shared
Consistency, no duplication
One route handler
Easy to understand flow
Helpers in libs/
Logic reused across tools
Where to put what
Styles for a single tool
In the component file as module or inline
SCSS module
Consistency Pattern
Look at existing similar tools and copy their structure:
Text converter? → Look at
upperCaseConverterComponent.tsxCode formatter? → Look at
jsonPrittifierComponent.tsx(uses Monaco Editor)Generator? → Look at
randomPasswordGenerator.tsxValidator? → Look at
jsonValidator.tsx
Copy the closest match. Don't reinvent.
Key files you'll edit 90% of the time
app/libs/developmentToolsConstant.tsx— Add tool metadataapp/libs/constants.tsx— Add route constantapp/components/developmentToolsComponent/YourTool.tsx— Build the toolapp/libs/helpers.tsx— Add shared logic if needed
Everything else just works automatically!
Last updated