Power of One News Admin Panel
A comprehensive content management system for managing news articles, categories, shorts, magazines, users, notifications, and site configuration.
Overview
Power of One News Admin Panel is a web-based CMS for the Power of One News platform. Administrators manage news articles, categories, short-form stories, magazines, advertisements, user-generated content, push notifications, and site configuration from a single dashboard.
The application is a Next.js 15 frontend that communicates with the backend API. Media assets are stored on AWS S3.
| Property | Value |
|---|---|
| Project name | powerofone-news-admin |
| Framework | Next.js 15 (App Router) |
| Language | TypeScript |
| Node.js | >= 18.18.0 |
| Default API | https://backend.powerofonenews.com/api |
| Production port | 9999 (PM2) |
Getting Started
Prerequisites
- Node.js >= 18.18.0
- npm (or yarn / pnpm)
- Access to the Power of One News backend API
- Google Cloud Translation API key (for translation features)
Installation
# Clone the repository git clone <repository-url> cd POON_Admin # Install dependencies npm install # Create .env.local with required keys (see Environment Variables) # Start development server npm run dev
Open http://localhost:3000 and log in with an authorized admin mobile number.
Available Scripts
| Command | Description |
|---|---|
npm run dev | Start development server (port 3000) |
npm run build | Production build |
npm run start | Start production server |
npm run lint | Run ESLint |
Environment Variables
Create a .env.local file in the project root:
# Backend API base URL (optional โ defaults to production API) NEXT_PUBLIC_API_BASE_URL=https://backend.powerofonenews.com/api # AES encryption key for auth payloads (optional โ has built-in fallback) NEXT_PUBLIC_ENTK_VALUE=your-encryption-key # Google Cloud Translation API key (required for auto-translation) NEXT_PUBLIC_GOOGLE_TRANSLATE_API_KEY=your-google-translate-api-key # LibreTranslate API URL (optional fallback for translation) NEXT_PUBLIC_LIBRETRANSLATE_API_URL=https://libretranslate.de/translate
.env.local or expose API keys in version control.Features
Core Content Management
Dashboard
Overview with article stats, recent articles, category breakdown, and quick actions.
Posts
Full article lifecycle โ list, filter, create, edit, delete including translation groups.
Categories
Hierarchical categories with multi-language translations and image upload.
News Items
Editorial tags: features, trending, popular, latest, editor-pick, breaking.
Shorts
Short-form story content โ create, edit, and publish.
Magazine
Digital magazine uploads (PDF/image) with metadata.
Gallery
Image and video gallery with filtering and thumbnails.
Blog Posts
Blog content management (routes exist; nav item currently commented out).
Engagement & Users
| Module | Description |
|---|---|
| Comments | Moderate comments on news, blog, and story content |
| Users | View registered app users, profiles, preferences, and block status |
| Contact | Manage contact form submissions โ view, mark as read, delete |
| Notifications | Send push notifications (broadcast or to selected users) |
Platform Capabilities
Technology Stack
Frontend
| Technology | Purpose |
|---|---|
| Next.js 15 | React framework with App Router |
| React 19 | UI library |
| TypeScript | Type-safe development |
| Bootstrap 5 | Base styling |
| Axios | HTTP client with interceptors |
| React Hook Form + Yup | Form validation |
| Crypto-JS | AES encryption for API payloads |
| Custom RichTextEditor | Content editor with media upload |
External Services
| Service | Purpose |
|---|---|
| Power of One News Backend API | All CRUD operations |
| AWS S3 | Image, video, and file storage |
| Google Cloud Translation API | Multi-language article translation |
| PM2 | Process manager in production |
Architecture
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Admin Browser (Client) โ
โ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Login / OTP โ โ Dashboard โ โ Module Components โ โ
โ โโโโโโโโฌโโโโโโโ โโโโโโโโฌโโโโโโโโ โโโโโโโโโโโโฌโโโโโโโโโโโ โ
โ โโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โผ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ apiService (api.ts) โ โ
โ โ axiosClient โ โ
โ โ AES Encryption โ โ
โ โโโโโโโโโโโโโฌโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ HTTPS (Bearer Token)
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Backend API โ
โ backend.powerofone- โ
โ news.com/api โ
โโโโโโโโโโโโโฌโโโโโโโโโโโโโ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโ
โ AWS S3 (media) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโ
Request Flow
- Admin enters mobile number โ OTP sent via encrypted payload to
/admin/auth/otp/send - Admin verifies OTP โ JWT token returned from
/admin/auth/otp/verify - Token stored in
localStorageasauthToken - All subsequent requests include
Authorization: Bearer <token>via Axios interceptor - On 401 response, session is cleared and user is redirected to login
Routing Model
| Route | Description |
|---|---|
/ | Login page (OTP flow) |
/dashboard | Main dashboard (tab switching via ?tab=) |
/dashboard/articles/create | Create article |
/dashboard/articles/edit/[id] | Edit article |
/dashboard/news-items/create | Create news item tag |
/dashboard/shorts/create | Create short story |
/dashboard/gallery/create | Create gallery entry |
/dashboard/blog-posts/create | Create blog post |
Project Structure
POON_Admin/ โโโ .github/workflows/main.yml # CI/CD โ deploy on push to main โโโ docs/ # HTML documentation (this site) โโโ public/assets/ # Static CSS, fonts, icons โโโ src/ โ โโโ app/ โ โ โโโ layout.tsx # Root layout โ โ โโโ page.tsx # Login / OTP entry โ โ โโโ dashboard/ โ โ โโโ page.tsx # Main dashboard shell โ โ โโโ articles/ # Article create & edit โ โ โโโ news-items/ # News item create & edit โ โ โโโ shorts/ # Short story create & edit โ โ โโโ gallery/ # Gallery create & edit โ โ โโโ blog-posts/ # Blog create & edit โ โโโ components/ โ โ โโโ auth/ # LoginForm, OtpVerification โ โ โโโ dashboard/ # All management modules โ โโโ layouts/ # Wrapper.tsx โ โโโ modals/ # ImagePopup, VideoPopup โ โโโ styles/ # index.css, auth.css โ โโโ utils/ โ โโโ api.ts # API service & endpoints โ โโโ apiConfig.ts # Base URL & token helper โ โโโ axiosClient.ts # Axios instance & interceptors โ โโโ translation.ts # Multi-language translation โ โโโ utils.ts # Helpers (slug generation) โโโ next.config.js โโโ package.json โโโ .env.local # Environment variables (not committed)
Authentication
Login Flow
- Mobile Number โ Admin enters a 10-digit Indian mobile number
- OTP Send โ
apiService.sendOtp(mobile)encrypts{ mobile }with AES and posts to/admin/auth/otp/send - OTP Verify โ Admin enters OTP; encrypted payload posted to
/admin/auth/otp/verify - Session โ On success,
authToken,isAuthenticated, andmobileare stored inlocalStorage
Session Protection
- Dashboard checks
isAuthenticatedon mount; redirects to/if missing - Axios interceptor attaches Bearer token to every request
- 401 responses clear session and surface "Session expired" errors
- Logout clears all auth keys and redirects to login
NEXT_PUBLIC_ENTK_VALUE or falls back to the built-in default in api.ts.Multi-Language Support
Supported Languages
| Code | Language |
|---|---|
en | English |
hi | Hindi |
mr | Marathi |
te | Telugu |
ta | Tamil |
kn | Kannada |
gu | Gujarati |
bn | Bengali |
pa | Punjabi |
Article Translation
When creating or editing articles, admins can enable automatic translation via translation.ts:
- Translates title, subtitle, description, and content
- Uses Google Cloud Translation API when API key is set
- Fallback providers: LibreTranslate, MyMemory
- Groups translations via
translationGroupIdon the backend
Deployment
CI/CD (GitHub Actions)
Pushing to the main branch triggers automatic deployment:
- Code synced via
rsyncto server at52.221.144.52 - Deploy path:
/var/www/html/powerofone-news-admin/ npm installandnpm run buildrun on the server- PM2 starts the app as
powerkaadminon port 9999
Manual Deployment
npm install npm run build npm run start -- -p 9999 # Or with PM2: pm2 start npm --name "powerkaadmin" -- run start -- -p 9999
API Integration
Base URL: NEXT_PUBLIC_API_BASE_URL or https://backend.powerofonenews.com/api
Client: src/utils/axiosClient.ts ยท Service: src/utils/api.ts
| Category | Endpoints |
|---|---|
| Auth | POST /admin/auth/otp/send, POST /admin/auth/otp/verify |
| Dashboard | GET /admin/dashboard |
| Categories | POST /admin/category/create|update|delete, GET /admin/category/list |
| News | POST /admin/news/create|update|delete, GET /admin/news/list |
| News Items | POST /admin/newsItems/create|update, GET /admin/newsItems/list |
| Stories | POST /admin/story/create|update|delete, GET /admin/story/list |
| Gallery | POST /admin/gallery/create|update, GET /admin/gallery/list |
| Magazine | POST /admin/magazine/create|update|delete, GET /admin/magazine/list |
| Advertisements | POST /admin/advertise/create|update|delete, GET /admin/advertise/list |
| Comments | GET /admin/comment/list|list-by-type, update, delete |
| Contact | GET /admin/contact/list, mark-as-read, update, delete |
| Users | GET /admin/user-list |
| Notifications | POST /admin/notification/send|broadcast, GET /admin/notification/users-list |
| Upload | POST /admin/upload-image, POST /admin/upload-contentImage |
| Sitemap | POST /admin/generate-sitemap, GET /admin/sitemap |
All endpoint constants are defined in API_ENDPOINTS inside src/utils/api.ts.
Module Reference
Dashboard
Article stats, language-filtered counts, recent articles table with status filters, category overview, and quick actions.
Posts (Articles)
Paginated list, category filter, bulk delete, rich text editor, image upload, news item tags, and auto-translation.
Categories
Parent-child hierarchy, 9-language translations, image upload, display order, enable/disable.
News Items
Editorial tags: features, trending, popular, latest, editor-pick, breaking. Toggle active status.
Shorts
Short-form stories with title, content, author, category, image, and publish date.
Magazine
Upload PDF/image magazines with title, author, description, publish date, and active status.
Gallery
Image and video entries with thumbnails, search/filter, and active/inactive status.
Comments
Filter by news/blog/story. Approve, deactivate, or delete. Paginated list with article titles.
Users
View profiles, preferences, liked/bookmarked content. Block/unblock users.
Contact
List submissions, view messages, mark as read, delete.
Notifications
Broadcast or targeted push notifications with title, body, image, and linked article.
Advertisements
Banner ads with image upload, link URL, display order, and active status.
Settings
Social media links, sitemap generation/download, general and security sections.
UI & UX
| Feature | Details |
|---|---|
| Navigation | Collapsible side drawer, active tab highlighting, mobile overlay, desktop persistent sidebar |
| Theme | Light/dark mode via tg-theme attribute, persisted in localStorage |
| Toasts | react-toastify โ success, error, info, warning (top-center) |
| Forms | React Hook Form + Yup validation, loading states on submit |
| Rich Text Editor | Bold, italic, headings, lists, links, inline image/video upload to S3, media resize panel |
Media Storage
Uploaded images and files are stored on AWS S3. The API returns relative paths; the frontend constructs full URLs:
https://stagingpowerofnews.s3.ap-southeast-1.amazonaws.com/<path>
POST /admin/upload-imageโ Featured images, category imagesPOST /admin/upload-contentImageโ Inline content images in the rich text editor
Troubleshooting
| Issue | Solution |
|---|---|
| "Session expired" on API calls | Log out and log in again; check that authToken is valid |
| Translation fails | Verify NEXT_PUBLIC_GOOGLE_TRANSLATE_API_KEY is set and billing is enabled |
| Images not loading | Confirm S3 path is correct and the bucket/object is publicly accessible |
| Build fails on lint | ESLint errors are ignored during builds (eslint.ignoreDuringBuilds: true) |
| OTP not received | Confirm mobile number is registered as admin on the backend |