Welcome to the Nakh Front-end project! This repository contains the front-end code for Nakh, a modern and scalable chat application designed for real-time communication, conversations management, and seamless user experience.
- Introduction
- Technologies Used
- Installation
- Usage
- Scripts
- Project Structure
- Per-Route Structure (App Router)
- Localization
- Contributing
- License
Nakh is a real-time chat platform that provides a clean, fast, and responsive interface for messaging, conversations, contacts, and user presence. The front-end is designed with scalability, maintainability, and developer experience in mind, making it suitable for both small teams and large-scale applications.
To get a local copy of the project up and running, follow these steps.
If you don't have Bun installed, follow the instructions here.
git clone https://github.com/agroture/nakh.git
cd nakhbun installTo start the development server, you can specify a port:
PORT=3000 bun run dev
# or
bun run dev 3000The app will be available at http://localhost:3000 (or your specified port).
-
Start Development Server
bun run dev [port] -
Build for Production
bun run build -
Check Code Formatting
bun run format:check -
Fix Code Formatting
bun run format:fix
The project uses the Next.js App Router structure under the /src
directory.
/
├── public/
│ ├── img/ # Images (avatars, chat assets, etc.)
│ ├── fonts/
│ │ ├── fa/ # Persian fonts
│ │ ├── en/ # Latin fonts
│ │ └── mono/ # Monospaced fonts
│ ├── logo/ # Brand logos and icons
│ └── svg/
│ └── ui/ # UI-related SVG icons
├── serviceWorker/ # Service worker & offline support
├── src/
│ ├── app/ # App Router entrypoint (routes, layouts, etc.)
│ │ ├── (route folders)
│ │ ├── layout.tsx
│ │ └── page.tsx
│ ├── components/ # Shared, reusable components
│ ├── features/ # Feature-based modules (chat, auth, profile, etc.)
│ ├── ui/ # Atomic UI components
│ ├── config/ # App-wide configuration
│ ├── hooks/ # Global custom React hooks
│ ├── lib/ # Utilities built on external libraries
│ ├── locales/ # i18n translation files
│ ├── shared/ # Shared types, Zod schemas, enums
│ ├── styles/ # Global styles
│ └── utils/ # General utility functions
└── ...
Each route inside src/app follows a modular, feature-oriented structure.
Example for /src/app/chat:
/src/app/chat/
│
├── modules/
│ ├── components/
│ │ ├── index.tsx # Barrel file
│ │ ├── ChatMainView.tsx # Main chat view
│ │ └── ...other components
│ ├── generics/
│ │ ├── index.ts
│ │ ├── types.ts # Chat-related types
│ │ ├── schema.ts # Zod schemas (messages, rooms, etc.)
│ │ └── constants.ts # Chat constants
│ ├── services/
│ │ ├── index.ts
│ │ └── ...API / socket calls
│ ├── utils/
│ │ ├── index.ts
│ │ └── ...route-only helpers
│ └── hooks/
│ ├── index.ts
│ └── ...chat-specific hooks
│
├── page.tsx # Route entry
├── layout.tsx # (Optional) Route layout
└── README.md # Route documentation
Notes:
- All folders inside
modulesare optional. componentsmust contain a barrel file and a main view component named after the route.genericsholds route-only types, schemas, and constants.serviceshandles API, WebSocket, or real-time communication logic.- Each route should include a
README.mddescribing its structure and behavior.
Nakh supports multiple languages using JSON-based localization files located in
the /messages directory.
-
Language files:
en.jsonfa.json
-
Each route has its own top-level key.
Example for the chat route:
// en.json
{
"chat": {
"navbar": {
"title": "Chat",
"newMessage": "New Message"
},
"main": {
"placeholder": "Type a message...",
"empty": "No messages yet"
}
}
}// fa.json
{
"chat": {
"navbar": {
"title": "چت",
"newMessage": "پیام جدید"
},
"main": {
"placeholder": "پیام خود را بنویسید...",
"empty": "پیامی وجود ندارد"
}
}
}Best Practices:
- Always update all language files together.
- Keep
navbarandmainsections consistent. - Use descriptive and stable keys.
Contributions are welcome and appreciated.
We use Conventional Commits:
feat: New featuresfix: Bug fixespatch: Minor fixesstyle: Formatting or styling changesrefactor: Code restructuringcleanup: Remove unused codeperf: Performance improvementsdependency: Dependency updatesrelease: Release taggingbuild: Build or config changeschore: Maintenance tasks
- Fork the repository.
- Create your branch:
git checkout -b feature/YourFeature - Commit your changes. Formatting and linting are handled automatically by Husky.
- Push your branch:
git push origin feature/YourFeature - Open a pull request.
This project uses Husky to automatically run formatting and linting on each commit. Manual formatting or linting is not required.
Distributed under the MIT License. See LICENSE for more information.
If you want, I can also:
- tighten language further (more technical, less marketing),
- adapt it for real-time (WebSocket) emphasis,
- or align it with a monorepo / backend README for Nakh.