This project features both an interactive web application and a public API for generating authentic Sri Lankan names. The backend model is trained on a massive dataset of over 10 million names, blending cultural heritage with artificial intelligence.
The web application provides a user-friendly interface to:
- Generate Names: Filter names by gender and a desired IQ level (0-100).
- Explore Meanings: Click on any generated name to get a detailed, AI-powered explanation of its meaning and origin.
- Multi-Language Support: View name explanations in multiple languages, including English, Sinhala, Tamil, and more.
- Light & Dark Mode: A sleek, modern interface with theme support for comfortable viewing.
Follow these instructions to get a copy of the project up and running on your local machine for development and testing purposes.
- A modern web browser.
- A Google Gemini API key to use the name-meaning feature. You can generate a free key from Google AI Studio.
- Python 3 or Node.js installed on your machine to run a local server.
-
Clone the Repository: Open your terminal and run the following command to clone the project:
git clone https://github.com/ishanoshada/Ai-Sri-Lanka-Name-Generator.git cd Ai-Sri-Lanka-Name-Generator -
Set Up Your API Key: The application needs your Gemini API key to function. The
App.tsxfile is configured to read this key fromprocess.env.API_KEY. For local development, you must replaceprocess.env.API_KEYinApp.tsxwith your actual key string.Important: This method is for local testing only. Do not commit your API key to a public repository. In environments like Google AI Studio, you should use the provided secrets manager to set the
API_KEY.
This section provides a concise overview of the API usage, detailing the endpoints, their purposes, request methods, parameters, and responses.
The application exposes four endpoints, all accessible via https://names.ishanoshada.com/. Each endpoint supports CORS, allowing cross-origin requests with methods GET, POST, PUT, DELETE, PATCH, OPTIONS and headers Content-Type, Authorization, X-Requested-With.
- Method:
GET - Purpose: Retrieve a random list of names filtered by gender and optional minimum IQ.
- Query Parameters:
gender(required, string): Specifies the gender of names to return. Must be"male"or"female". Case-insensitive.num(optional, integer): Number of names to return (1–1000). Defaults to10if not provided.iq(optional, integer): Minimum IQ threshold (0–100). Filters names to include only those with IQ greater than or equal to the specified value.
- Response:
- Success (200): JSON array of objects with
Name(string) andIQ(integer).[ {"Name": "John Doe", "IQ": 85}, {"Name": "Saman Perera", "IQ": 92} ] - Error (400):
{"error": "Gender must be 'male' or 'female'"}{"error": "Number of names must be between 1 and 1000"}{"error": "IQ must be between 0 and 100 if provided"}{"error": "Not enough [gender] names available (found X, requested Y)"}
- Error (500):
{"error": "Internal server error"}
- Success (200): JSON array of objects with
- Example Request:
curl "https://names.ishanoshada.com/names?gender=male&num=5&iq=80" - Example Response:
[ {"Name": "Kavinda Silva", "IQ": 82}, {"Name": "Mohamed Fazil", "IQ": 90}, {"Name": "Sujeewa Bandara", "IQ": 85}, {"Name": "Nuwan Perera", "IQ": 88}, {"Name": "Chamod Fernando", "IQ": 95} ]
- Method:
GET - Purpose: Return the percentage distribution of genders (male, female, unknown).
- Response:
- Success (200):
{ "male_percentage": 45.5, "female_percentage": 50.0, "unknown_percentage": 4.5 } - Error (400):
{"error": "No data available"}
- Success (200):
- Method:
GET - Purpose: Return the count of male students in predefined IQ ranges.
- Response:
- Success (200):
[ {"range": "0-20", "count": 10}, {"range": "20-35", "count": 15}, {"range": "35-50", "count": 20}, {"range": "50-75", "count": 30}, {"range": "75-100", "count": 25} ]
- Success (200):
- Method:
GET - Purpose: Return the count of female students in predefined IQ ranges.
- Response:
- Success (200):
[ {"range": "0-20", "count": 8}, {"range": "20-35", "count": 12}, {"range": "35-50", "count": 15}, {"range": "50-75", "count": 28}, {"range": "75-100", "count": 37} ]
- Success (200):