Skip to content

maxjeffwell/full-stack-capstone-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

educationELLy Server

Node.js Express.js MongoDB JWT License: GPL v3

πŸ“– Overview

educationELLy Server is the backend API for the educationELLy application - a comprehensive platform designed to support English Language Learning (ELL) students and their teachers. This Express.js server provides secure authentication, RESTful API endpoints, and data persistence for managing ELL student information.

🎯 Mission: Bridging the gap between ELL specialists and mainstream classroom teachers through technology.

✨ Key Benefits:

  • Centralized access to student language proficiency data
  • Enhanced collaboration between ELL specialists and teachers
  • Streamlined student data management
  • Real-time access to critical learning information

✨ Features

  • πŸ” Secure Authentication - JWT-based authentication with Passport.js
  • πŸ“Š Student Management - Full CRUD operations for ELL student profiles
  • πŸ”’ Protected Routes - Role-based access control for sensitive data
  • πŸ“± RESTful API - Clean, intuitive API design following REST principles
  • πŸš€ Production Ready - Deployed on Heroku with MongoDB Atlas
  • βœ… Validation - Input validation and error handling

🎯 Demo Account

ℹ️ Info: To explore the application, you can use the following demo credentials:

# Demo Credentials
Email: demo@example.com
Password: demopassword

⚠️ Note: These are demo credentials for testing purposes only.

πŸš€ Getting Started

πŸ“‹ Prerequisites

  • Node.js (v10.11.0 or higher)
  • npm or yarn
  • MongoDB (local or Atlas)
  • Git

βš™οΈ Installation

  1. Clone the repository:

    git clone https://github.com/maxjeffwell/full-stack-capstone-server.git
    cd full-stack-capstone-server
  2. Install dependencies:

    npm install
  3. Create a .env file in the root directory:

    MONGODB_URI=mongodb://localhost/educationelly
    JWT_SECRET=your_jwt_secret_here
    NODE_ENV=development
    PORT=8080
  4. Start the development server:

    npm start

The server will start on http://localhost:8080 with automatic reloading via nodemon.

βœ… Success: Your server is now running and ready for development!

πŸ“š API Documentation

πŸ” Authentication Endpoints

Method Endpoint Description Auth Required
POST /signup Register a new user ❌ No
POST /signin Login user (returns JWT) ❌ No
GET /logout Logout current user βœ… Yes
GET /whoami Get current user info βœ… Yes

πŸ‘₯ Student Management Endpoints

Method Endpoint Description Auth Required
GET /students Get all students βœ… Yes
GET /students/:id Get student by ID βœ… Yes
POST /students Create new student βœ… Yes
PUT /students/:id Update student βœ… Yes
DELETE /students/:id Delete student βœ… Yes

πŸ’¬ Request/Response Examples

πŸ‘€ Register User

POST /signup
Content-Type: application/json

{
  "email": "teacher@school.edu",
  "password": "securepassword123"
}

Response: 
{
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}

πŸŽ“ Create Student

POST /students
Authorization: Bearer <token>
Content-Type: application/json

{
  "fullName": "John Doe",
  "school": "Lincoln Elementary",
  "teacher": "Ms. Smith",
  "gradeLevel": 5,
  "nativeLanguage": "Spanish",
  "ellStatus": "Intermediate",
  "designation": "ELL"
}

πŸ—οΈ Project Structure

educationELLy-server/
β”œβ”€β”€ controllers/
β”‚   └── authentication.js    # Auth logic (signup/signin)
β”œβ”€β”€ models/
β”‚   β”œβ”€β”€ student.js          # Student schema
β”‚   └── user.js             # User schema with password hashing
β”œβ”€β”€ services/
β”‚   └── passport.js         # JWT & Local strategies
β”œβ”€β”€ test/
β”‚   β”œβ”€β”€ server.test.js      # Server tests
β”‚   └── user.test.js        # Auth tests
β”œβ”€β”€ index.js                # Express server setup
β”œβ”€β”€ router.js               # Route definitions
β”œβ”€β”€ .env                    # Environment variables
β”œβ”€β”€ .babelrc                # Babel configuration
β”œβ”€β”€ .eslintrc.js            # ESLint rules
β”œβ”€β”€ package.json            # Dependencies & scripts
└── Procfile                # Heroku deployment

πŸ”’ Authentication & Security

🎫 JWT Authentication Strategy

The server implements a stateless JWT (JSON Web Token) authentication system using Passport.js:

  • Token Generation: JWTs are created upon successful login/signup containing user ID and timestamp
  • Token Expiration: Tokens expire after 7 days for security
  • Token Validation: Every protected route validates the JWT from the Authorization header
  • Stateless Design: No server-side session storage - tokens contain all necessary auth information
  • Bearer Token Format: Clients must send tokens as Authorization: Bearer <token>

The JWT strategy extracts tokens from request headers, verifies signatures using the JWT_SECRET, and validates token expiration. Invalid or expired tokens are automatically rejected.

πŸ› οΈ Technologies

⚑ Core

  • Express.js - Web application framework
  • MongoDB - NoSQL database
  • Mongoose - MongoDB object modeling
  • Passport.js - Authentication middleware
  • JWT - Secure token-based auth

πŸ›‘οΈ Security

  • bcryptjs - Password hashing
  • CORS - Cross-origin resource sharing
  • dotenv - Environment variable management

πŸ”§ Development

  • Nodemon - Auto-restart on file changes
  • Babel - ES6+ transpilation
  • ESLint - Code linting
  • Mocha/Chai - Testing framework

πŸ§ͺ Testing

Run the test suite:

npm run test2

πŸ§ͺ Test Coverage:

  • βœ… Server connection tests
  • βœ… Authentication flow tests
  • βœ… API endpoint tests
  • βœ… Error handling tests

πŸš€ Deployment

☁️ Heroku Deployment

  1. Create a Heroku app:

    heroku create your-app-name
  2. Set environment variables:

    heroku config:set MONGODB_URI=your_mongodb_atlas_uri
    heroku config:set JWT_SECRET=your_production_secret
  3. Deploy:

    git push heroku master

🌍 Environment Variables

Variable Description Default
MONGODB_URI MongoDB connection string mongodb://localhost/local
JWT_SECRET Secret for JWT signing Required
NODE_ENV Environment (production/development) development
PORT Server port 8080

🎯 Next Steps

⚑ Immediate Priorities

  • Add Comprehensive Testing - Expand test coverage to include all endpoints and edge cases
  • Implement Rate Limiting - Add protection against API abuse and brute force attacks
  • Add Request Validation - Implement robust input validation using Joi or express-validator
  • Enhanced Error Handling - Create custom error classes and centralized error handling middleware

🌟 Feature Enhancements

  • Role-Based Access Control - Implement teacher/admin/student roles with different permissions
  • Progress Tracking API - Add endpoints for tracking student language learning progress over time
  • Bulk Operations - Support bulk student imports via CSV/Excel
  • Real-time Updates - Implement WebSocket support for real-time notifications
  • File Upload - Add support for student document/assessment uploads
  • API Versioning - Implement versioned endpoints (e.g., /api/v1/students)

πŸ“ˆ Performance & Scalability

  • Database Indexing - Add MongoDB indexes for frequently queried fields
  • Caching Layer - Implement Redis for caching frequently accessed data
  • Pagination - Add pagination support for student list endpoints
  • Query Optimization - Implement field selection and populate optimization

πŸ“– Documentation & Developer Experience

  • API Documentation - Generate interactive API docs using Swagger/OpenAPI
  • Postman Collection - Create and maintain a Postman collection for easy API testing
  • Docker Support - Add Dockerfile and docker-compose for containerized development
  • CI/CD Pipeline - Set up GitHub Actions for automated testing and deployment

πŸ” Security Enhancements

  • Refresh Tokens - Implement JWT refresh token mechanism
  • Password Reset - Add forgot password functionality with email verification
  • Two-Factor Authentication - Optional 2FA for enhanced security
  • Audit Logging - Track all data modifications for compliance

πŸ”— Integration Features

  • Email Notifications - Send updates about student progress
  • Export Functionality - Generate PDF/Excel reports of student data
  • Third-party Integrations - Connect with school management systems
  • Backup Strategy - Implement automated database backups

🀝 Contributing

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

πŸ“„ License

This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.

πŸ‘¨β€πŸ’» Author

Jeff Maxwell

πŸ™ Acknowledgments

  • Thanks to all contributors who have helped shape educationELLy
  • Special recognition to ELL teachers and specialists who provided valuable feedback
  • Built with ❀️ for the education community

🌟 **Star this repository if it helped you!** 🌟

About

No description or website provided.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •