Skip to content

Repository files navigation

dadapay - Read & Earn πŸ“šπŸ’°

A modern news reading platform where users earn rewards for reading quality articles. Stay informed while getting rewarded for your engagement with news content.

dadapay React TypeScript PostgreSQL

🌟 Features

Core Functionality

  • πŸ“– Quality Content: Curated articles across multiple categories
  • πŸ’° Token Rewards: Earn ₦50 tokens for each completed article
  • πŸ” User Authentication: Secure login system to track progress
  • πŸ” Search & Filter: Find articles by keywords and filter by categories
  • πŸ“± Responsive Design: Fully optimized for all devices and screen sizes
  • πŸ›‘οΈ Role-Based Access: Different access levels for users, editors, and admins
  • ✏️ Content Management: Full CMS for editors and admins to create articles

πŸš€ Demo Accounts

For Testing and Demonstration

Since this is a demo application, you can use these pre-created accounts to explore different features:

Regular User Account

  • Username: user_demo
  • Email: user@dadapay.demo
  • Password: demo123
  • Features: Read articles, earn tokens, view dashboard
  • Starting Balance: ₦1,250 tokens

Admin Account

  • Username: admin_demo
  • Email: admin@dadapay.demo
  • Password: admin123
  • Features: Full access - manage users, articles, view analytics
  • Starting Balance: ₦5,000 tokens

Editor Account

  • Username: editor_demo
  • Email: editor@dadapay.demo
  • Password: editor123
  • Features: Create and edit articles, moderate content
  • Starting Balance: ₦2,500 tokens

Note: These are demo accounts for testing purposes. In a production environment, users would create their own accounts through the registration system.

Categories

  • Politics
  • Technology
  • Sports
  • Business
  • Entertainment

User Experience

  • Hero Section: Engaging landing area with call-to-action
  • Category Filters: Easy navigation between different content types
  • Article Cards: Beautiful preview cards with images and metadata
  • Reading Modal: Focused reading experience with completion tracking
  • Statistics Section: Display user engagement metrics
  • Dark/Light Theme: Toggle between themes (configured)

πŸ› οΈ Technology Stack

Frontend Framework

  • React 18.3.1 - Modern React with hooks and context
  • TypeScript - Type-safe development
  • Vite - Fast build tool and development server

UI & Styling

  • Tailwind CSS - Utility-first CSS framework
  • shadcn/ui - High-quality accessible components
  • Radix UI - Primitive components for accessibility

State Management & Data

  • React Context - Application state management
  • React Query - Data fetching and caching
  • React Router Dom - Client-side routing

Development Tools

  • ESLint - Code linting and formatting
  • PostCSS - CSS processing
  • Autoprefixer - CSS vendor prefixing

πŸš€ Getting Started

Prerequisites

  • Node.js 18+
  • npm or yarn package manager

Installation

  1. Clone the repository

    git clone <repository-url>
    cd read-earn-naira
  2. Install dependencies

    npm install
  3. Start development server

    npm run dev
  4. Open your browser

    http://localhost:5000
    

Available Scripts

npm run dev          # Start development server
npm run build        # Build for production
npm run build:dev    # Build in development mode
npm run preview      # Preview production build
npm run lint         # Run ESLint

πŸ“ Project Structure

src/
β”œβ”€β”€ components/           # Reusable UI components
β”‚   β”œβ”€β”€ ui/              # shadcn/ui components
β”‚   β”‚   β”œβ”€β”€ button.tsx
β”‚   β”‚   β”œβ”€β”€ card.tsx
β”‚   β”‚   β”œβ”€β”€ dialog.tsx
β”‚   β”‚   └── ...          # Other UI primitives
β”‚   β”œβ”€β”€ AppLayout.tsx    # Main application layout
β”‚   β”œβ”€β”€ ArticleModal.tsx # Article reading interface
β”‚   β”œβ”€β”€ Header.tsx       # Navigation header
β”‚   β”œβ”€β”€ NewsCard.tsx     # Article preview cards
β”‚   β”œβ”€β”€ LoginModal.tsx   # User authentication
β”‚   β”œβ”€β”€ Footer.tsx       # Site footer
β”‚   └── StatsSection.tsx # User statistics display
β”œβ”€β”€ contexts/            # React Context providers
β”‚   └── AppContext.tsx   # Global application state
β”œβ”€β”€ data/               # Static data and types
β”‚   β”œβ”€β”€ articles.ts     # Article data and interfaces
β”‚   └── moreArticles.ts # Additional article content
β”œβ”€β”€ hooks/              # Custom React hooks
β”‚   β”œβ”€β”€ use-mobile.tsx  # Mobile device detection
β”‚   └── use-toast.ts    # Toast notification hook
β”œβ”€β”€ lib/                # Utility functions
β”‚   └── utils.ts        # Helper functions and utilities
β”œβ”€β”€ pages/              # Route components
β”‚   β”œβ”€β”€ Index.tsx       # Home page
β”‚   └── NotFound.tsx    # 404 error page
β”œβ”€β”€ App.tsx             # Root application component
β”œβ”€β”€ main.tsx           # Application entry point
└── index.css          # Global styles and Tailwind imports

🎯 How It Works

User Journey

  1. Landing: Users arrive at the hero section explaining the concept
  2. Browse: Users can view articles by category or search for specific topics
  3. Login: Users authenticate to start earning tokens
  4. Read: Users click articles to open the reading modal
  5. Earn: Upon completing an article, users earn ₦50 Naira tokens
  6. Track: Progress and earnings are tracked in the user's account

Token System

  • Starting Bonus: ₦100 tokens upon first login
  • Reading Reward: ₦50 tokens per completed article
  • No Duplicates: Users can only earn tokens once per article

Article Management

  • Articles are stored in TypeScript files with full type safety
  • Each article includes: title, excerpt, content, image, category, author, and metadata
  • Articles are filterable and searchable in real-time

πŸ”§ Configuration

Environment Setup

The application is configured for:

  • Development: Hot reload with Vite dev server
  • Production: Optimized builds with code splitting
  • Replit: Ready for deployment on Replit platform

Customization

  • Colors: Modify tailwind.config.ts for brand colors
  • Components: Extend components/ui/ for new components
  • Articles: Add content to src/data/articles.ts

πŸš€ Deployment

Replit Deployment

This project is configured for Replit deployment:

  • Uses port 5000 for frontend
  • Host configured as 0.0.0.0 for proxy compatibility
  • All hosts allowed for iframe viewing

Build Process

npm run build     # Creates optimized production build
npm run preview   # Test production build locally

🀝 Contributing

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

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

  • shadcn/ui for the beautiful component library
  • Radix UI for accessible primitives
  • Tailwind CSS for utility-first styling
  • Vite for the excellent development experience

Start reading, start earning! πŸŽ‰

For questions or support, please open an issue in the repository.

About

Gamified reading-rewards interface built with React, TypeScript, Tailwind CSS, and Vite.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages