Skip to content

Multi-stage CAPTCHA system with Angular 19 & Node.js. Features image recognition, text/math challenges, state persistence, and responsive design.

Notifications You must be signed in to change notification settings

TanakAiko/angul-it

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

13 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Angul-It - Multi-Stage Captcha System

Angular TypeScript Node.js Express RxJS

A sophisticated multi-stage captcha web application built with Angular and Node.js, designed to verify human users through various challenge types including image recognition, text input, and mathematical problems.

Home Page

๐Ÿš€ Features

Core Functionality

  • Multi-Stage Verification: Three progressive challenge levels
  • Diverse Challenge Types: Image selection, text input, and math problems
  • State Persistence: Progress saved across browser sessions
  • Responsive Design: Optimized for desktop and mobile devices
  • Smooth Animations: Fluid transitions between challenges
  • Form Validation: Robust validation for all challenge types

Challenge Types

  1. Image Recognition: Select specific objects from image grids
  2. Text Input: Answer knowledge-based questions
  3. Mathematical: Solve arithmetic problems

User Experience

  • Progress Tracking: Visual progress bar with level indicators
  • Navigation: Move between completed levels
  • Session Management: Automatic state saving and restoration
  • Results Dashboard: Detailed completion statistics
  • Download Results: Export session data as JSON

๐Ÿ—๏ธ Architecture

Frontend (Angular 19)

  • Components: Home, Captcha, Result
  • Services: CaptchaService, StateService
  • Guards: CaptchaGuard for route protection
  • State Management: RxJS-based state management with localStorage persistence
  • Reactive Forms: Form validation and user input handling

Backend (Node.js + Express)

  • RESTful API: Challenge retrieval and answer validation
  • Challenge Management: JSON-based challenge storage
  • CORS Support: Cross-origin resource sharing enabled
  • Modular Structure: Organized route handlers and middleware

๐Ÿ“ Project Structure

angul-it/
โ”œโ”€โ”€ frontend/                 # Angular application
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ app/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ components/   # UI components
โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ home/
โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ captcha/
โ”‚   โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ result/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ services/     # Business logic services
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ guards/       # Route guards
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ models/       # TypeScript interfaces
โ”‚   โ”‚   โ””โ”€โ”€ styles.css        # Global styles
โ”‚   โ””โ”€โ”€ package.json
โ”œโ”€โ”€ backend/                  # Node.js API server
โ”‚   โ”œโ”€โ”€ routes/
โ”‚   โ”‚   โ””โ”€โ”€ captcha.js        # Captcha API endpoints
โ”‚   โ”œโ”€โ”€ levels/               # Challenge data
โ”‚   โ”‚   โ”œโ”€โ”€ 1.json
โ”‚   โ”‚   โ”œโ”€โ”€ 2.json
โ”‚   โ”‚   โ””โ”€โ”€ 3.json
โ”‚   โ”œโ”€โ”€ server.mjs            # Express server setup
โ”‚   โ””โ”€โ”€ package.json
โ””โ”€โ”€ README.md

๐Ÿ› ๏ธ Installation & Setup

Prerequisites

  • Node.js (v18 or higher)
  • npm or yarn
  • Angular CLI (npm install -g @angular/cli)

Backend Setup

cd backend
npm install
node server.mjs

The backend server will run on http://localhost:3000

Frontend Setup

cd frontend
npm install
ng serve

The frontend application will run on http://localhost:4200

๐ŸŽฎ Usage

Starting a Challenge

  1. Navigate to the home page
  2. Click "Start New Challenge" to begin
  3. Complete all three levels sequentially
  4. View detailed results upon completion

Challenge Interface

Image Selection Challenge Example of an image selection challenge where users identify specific objects

Challenge Navigation

  • Progress Bar: Visual indicator of completion status
  • Level Navigation: Move between completed levels
  • Form Validation: Real-time validation feedback
  • State Persistence: Progress automatically saved

Challenge Types

Image Selection

  • Select images matching the given criteria
  • Multiple selection support
  • Visual feedback for selected items
  • Validation ensures at least one selection

Text Input

  • Answer knowledge-based questions
  • Case-insensitive validation
  • Real-time form validation
  • Trim whitespace handling

Mathematical Problems

  • Solve arithmetic equations
  • Numeric input validation
  • Integer answer validation
  • Clear error messaging

Completion & Results

Results Page Detailed results dashboard showing session statistics and performance metrics

๐Ÿ”ง API Endpoints

GET /api/captcha

Retrieves a set of challenges for all three levels. Each level randomly selects a challenge from its pool.

Response Example:

{
  "level1": {
    "id": 2,
    "type": "text",
    "question": "What is the capital of Senegal?"
  },
  "level2": {
    "id": 2,
    "type": "image-select",
    "question": "Where is Luffy?",
    "images": [
      { "url": "https://...", "id": "img1" },
      { "url": "https://...", "id": "img2" },
      { "url": "https://...", "id": "img3" }
    ]
  },
  "level3": {
    "id": 1,
    "type": "image-select",
    "question": "Select all images with a bus",
    "images": [...]
  }
}

Note: Challenge types vary by level. Level 1 includes text and math challenges, Level 2 includes math and image-select challenges, and Level 3 includes various image-select challenges.

POST /api/captcha

Submits an answer for validation.

Request Examples:

Text answer:

{
  "id": 2,
  "level": 1,
  "answer": "Dakar"
}

Math answer:

{
  "id": 1,
  "level": 2,
  "answer": 42
}

Image selection answer:

{
  "id": 2,
  "level": 2,
  "answer": ["img1"]
}

Response:

{
  "success": true
}

Or on error:

{
  "success": false,
  "message": "Answer must be a non-empty string."
}

๐ŸŽจ Design Features

Visual Design

  • Modern UI: Clean, Apple-inspired design aesthetics
  • Color System: Comprehensive color palette with gradients
  • Typography: Optimized font hierarchy and spacing
  • Animations: Smooth transitions and micro-interactions
  • Responsive: Mobile-first responsive design

User Experience

  • Accessibility: WCAG compliant design patterns
  • Loading States: Clear loading indicators
  • Error Handling: Comprehensive error messaging
  • Progress Feedback: Visual progress indicators
  • Session Management: Seamless state persistence

๐Ÿงช Testing

Frontend Testing

cd frontend
ng test

Note: Backend testing is currently not implemented. Contributions are welcome!

๐Ÿ”’ Security Features

  • Input Validation: Server-side validation for all inputs
  • CORS Protection: Configured cross-origin policies
  • State Isolation: Session-based state management
  • Answer Validation: Secure server-side answer checking

๐Ÿ“ฑ Responsive Design

  • Mobile Optimized: Touch-friendly interface
  • Tablet Support: Optimized for medium screens
  • Desktop Enhanced: Full-featured desktop experience
  • Flexible Layouts: CSS Grid and Flexbox layouts

๐Ÿ™ Acknowledgments

  • Angular team for the excellent framework
  • Express.js for the robust backend framework
  • Contributors and testers who helped improve the application

๐Ÿค Contributing

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

โญ Star this repository if you found it helpful! โญ

Made with โค๏ธ from ๐Ÿ‡ธ๐Ÿ‡ณ

About

Multi-stage CAPTCHA system with Angular 19 & Node.js. Features image recognition, text/math challenges, state persistence, and responsive design.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published