Skip to main content

Explore. Code.
Master Everything.

A premium offline suite for extracting, parsing, and elegantly organizing educational content. This guide shows how to run the app on your computer.

Download Latest Release
EducativeViewer - Preview
EducativeViewer screenshot 1

Swipe left or right to view screenshots

B

Biraj Sarkar

Developer@Biraj2004

Architect of the Edu-Viewer interface and React ecosystem. Responsible for component logic, routing, UI/UX consistency, and core application rendering engines.

A

Anilabha Datta

Developer@anilabhadatta

Mastermind behind the data extraction pipeline. Developed the robust scraping engine ensuring seamless content portability into structured JSON formats.

educative-viewer Complete Setup Guide

Full-stack setup workflow for educative-viewer: architecture, backend bootstrap, frontend build-and-run flow, environment variables, proxy routing, and troubleshooting.

Download Viewer
Release: loading...

Prerequisites

  • Node.js 18+
  • Python 3.10+
  • Nginx or Apache (optional)

Ports and Routing

  • Frontend: Next.js on 3000
  • Backend: Flask on 5000
  • Proxy: localhost on 80

Recommended Start Order

  • Start backend first
  • Then frontend
  • Then proxy on localhost

1. Architecture Overview

Browser -> Nginx / Apache  (:80)
             |- /api/*  -> Flask       (:5000)   known API routes
             |- /api/*  -> local disk            static / image assets
             - /*      -> Next.js     (:3000)   everything else

Frontend

Next.js App Router

Port: 3000

Backend

Flask (Python 3.10+)

Port: 5000

Databases

SQLite with optional Oracle auth DB

Reverse Proxy

Nginx or Apache

Port: 80

2. Repository Structure

educative-viewer/
|- client/                  # Next.js frontend
|- server/                  # Flask backend
|  |- backend/
|  |  |- routes/            # Auth, courses, admin, contact endpoints
|  |  |- db/                # SQLite + Oracle adapters, DB manager
|  |  |- auth_service.py    # JWT, RSA, session, 2FA logic
|  |  - config.py          # AppConfig env parsing
|  |- app.py                # Flask app entrypoint
|  - setup_and_run.py      # First-time setup helper
|- proxy/                   # Nginx and Apache config files
|- Cloudflare_Vercel.md
|- CONTRIBUTING.md
|- SECURITY.md
- README.md

3. Backend Setup (Flask)

Open PowerShell in the server directory and run first-time setup:

cd server

# Create and activate a virtual environment
python -m venv env
.envScriptsActivate.ps1

# Install dependencies
pip install -r requirements.txt

# Run one-time setup helper
python setup_and_run.py

What setup_and_run.py handles automatically

  • Generates an RSA-2048 key pair and writes RSA_PRIVATE_KEY to server/.env.
  • Prints the RSA public key. Paste that value into frontend env as NEXT_PUBLIC_RSA_PUBLIC_KEY.
  • Prompts for required server .env values like DB paths, JWT secret, invite codes, and Flask port/debug.
  • On later runs, if RSA_PRIVATE_KEY already exists, key generation is skipped.

Subsequent backend runs:

cd server
.envScriptsActivate.ps1
python app.py

Keep this backend terminal running while frontend and proxy are active.

4. Frontend Setup (Next.js)

Open a second terminal in client and run:

cd client
npm install
node build-and-run.js
1) Full build + obfuscate + zip + create new release
2) Full build + obfuscate + zip + upload to existing release
3) Build + obfuscate + zip only (no upload)
4) Build + obfuscate + run local server
5) Build only (no obfuscation) + zip
6) Build and run local server
7) Upload existing .next.zip to existing release
8) Upload existing .next.zip as new release
9) Manage saved GitHub repos
0) Exit

For local development choose option 6. It prompts env values, builds, and serves at http://localhost:3000.

5. CLI Non-Interactive Commands

node build-and-run.js local      # prompt env -> build -> obfuscate -> start server
node build-and-run.js serve      # prompt env -> start server (needs existing .next)
node build-and-run.js build      # prompt env -> build -> obfuscate -> zip
node build-and-run.js build:only # prompt env -> build (no obfuscation) -> zip
node build-and-run.js upload     # zip -> upload to existing release
node build-and-run.js release    # zip -> create new release
node build-and-run.js download   # download .next.zip from release

6. Environment Variables Reference

VariableDescriptionLocal Default
NEXT_PUBLIC_BACKEND_API_BASEBase URL for Flask backendhttp://localhost/
NEXT_PUBLIC_STATIC_FILES_BASEBase URL for static/image assetshttp://localhost/
NEXT_PUBLIC_RSA_PUBLIC_KEYPublic key printed by setup_and_run.pyPaste from backend output
NEXT_PUBLIC_STATIC_BASIC_AUTHOptional Basic Auth header for static workerLeave blank if unused
PROXY_SECRETSecret for x-edu-proxy headerNot required locally
VERCEL_ENVDeployment environment identifierdevelopment

Important: when VERCEL_ENV=production, middleware enforces x-edu-proxy == PROXY_SECRET. Use VERCEL_ENV=development for local runs.

7. Local Proxy Setup

Use this when you need one http://localhost URL that routes known backend API paths to Flask, serves static files from local disk under /api, and forwards everything else to Next.js.

Nginx (Windows)

  • Use config at proxy/nginx-windows.conf
  • Keep only one active localhost:80 server block
  • Confirm server_name and root values
  • server_name localhost; root C:/inetpub/wwwroot/educativeviewer;
  • Create local static folder
  • C:/inetpub/wwwroot/educativeviewer/api/images
  • Ensure upstreams map to Flask:5000 and Next:3000
nginx -t
nginx -s reload

Apache (Windows)

  • Use config at proxy/apache-windows.conf
  • Keep only one active localhost:80 vhost
  • Confirm Alias path
  • C:/inetpub/wwwroot/educativeviewer/api/
  • Store images in C:/inetpub/wwwroot/educativeviewer/api/images/
httpd -t
httpd -k restart

8. Start Order (Quick Reference)

1) Start backend
cd server
.\env\Scripts\Activate.ps1
python app.py

2) Start frontend
cd client
node build-and-run.js
# choose option 6

3) Start/reload proxy
nginx -s reload
# or
httpd -k restart

4) Open app
http://localhost

Always use proxy URL http://localhost instead of direct frontend URL for full API and static routing.

9. Verify Image Proxy

C:/inetpub/wwwroot/educativeviewer/api/images/logo.png

Verify static image routing with:

http://localhost/api/images/logo.png

If this URL opens the image directly, proxy static mapping is configured correctly.

10. Troubleshooting

API calls fail from frontend

Confirm Flask is running on 5000, frontend env uses localhost base URLs, and proxy is routing /api/* to Flask.

Frontend does not start

Use node build-and-run.js and choose option 6. To serve existing build without rebuilding, run:

node build-and-run.js serve

Images return 404 through proxy

Confirm file exists under:

C:/inetpub/wwwroot/educativeviewer/api/...

and ensure root/Alias paths match exactly.

Session expires or login redirects unexpectedly

Verify NEXT_PUBLIC_RSA_PUBLIC_KEY in client env exactly matches the public key printed by setup_and_run.py. Any mismatch can break browser-side encryption.

Port already in use

Update conflicting proxy/backend ports and the matching frontend environment values.

11. Related Documentation

Setup Guide Website

Visual walkthrough for local and production setup.

educative-viewer

Latest releases for educative-viewer.

Cloudflare_Vercel.md

Edge deployment with Cloudflare Worker and Vercel.

proxy/README.md

Detailed proxy routing rules and config reference.

This setup guide is synchronized with the latest README workflow. After backend, frontend, and proxy are active, use http://localhost as your primary local URL.