This project implements a RESTful API that analyzes strings and computes various properties such as length, palindrome check, and SHA-256 hash.
This API receives a string and returns a JSON object describing it. Example properties include:
- length— Number of characters
- is_palindrome— Whether it reads the same backward and forward (case-insensitive)
- unique_characters— Count of distinct characters
- word_count— Number of words separated by spaces
- sha256_hash— Secure hash of the string
- character_frequency_map— Count of each character’s occurrence
All analyzed strings are stored in memory (can be replaced with a database later).
| Component | Description | 
|---|---|
| Language | Python 3.10+ | 
| Framework | Flask | 
| Libraries | Flask,hashlib,datetime,re,gunicorn | 
| Hosting | Railway.app | 
git clone https://github.com/Programer-Ed/string_analyzer.git
cd string_analyzerpython3 -m venv venv
source venv/bin/activate    # On macOS/Linux
venv\Scripts\activate       # On Windowspip install -r requirements.txtIf you don’t have a requirements.txt yet, create one with:
Flask
gunicornpython app.pyThen open your browser or Postman and visit:
http://127.0.0.1:5000
- app.py
- requirements.txt
- Procfile
web: gunicorn app:app
- Go to https://railway.app/
- Click "New Project" → "Deploy from GitHub"
- Connect your repository
- Railway will auto-detect your Procfileand start the Flask app
✅ Once deployed, you’ll get a public URL like:
https://string-analyzer-production.up.railway.app/
POST /strings
Body (JSON):
{ "value": "racecar" }Response:
{
  "id": "f5c5...",
  "value": "racecar",
  "properties": {
    "length": 7,
    "is_palindrome": true,
    "unique_characters": 5,
    "word_count": 1,
    "sha256_hash": "f5c5...",
    "character_frequency_map": { "r": 2, "a": 2, "c": 2, "e": 1 }
  },
  "created_at": "2025-10-21T00:00:00Z"
}GET /strings?q=car&is_palindrome=true&min_length=5
GET /strings/filter-by-natural-language?query=strings longer than 5 and palindromes
DELETE /strings/<string_value>
No environment variables are needed for this project (yet).
You can add one later, e.g. FLASK_ENV=production if desired.
1️⃣ Create a string → POST /strings
2️⃣ Get all strings → GET /strings
3️⃣ Search → GET /strings?q=go
4️⃣ Filter by NLP → GET /strings/filter-by-natural-language?query=palindromes longer than 4
5️⃣ Delete a string → DELETE /strings/<string_value>