This document contains comprehensive information for developers who want to contribute to or deploy the Google Play API project.
- Environment Setup
- Local Development
- API Configuration
- Testing
- Code Style Guidelines
- Contribution Process
- Deployment
- Roadmap
- Node.js 22 or higher
- npm (comes with Node.js)
- Git
The project relies on the following main dependencies:
express: Web framework for Node.jsgoogle-play-scraper: Core library for scraping Google Play datacors: Middleware for enabling CORSexpress-rate-limit: Rate limiting middlewaremorgan: HTTP request loggerswagger-ui-express: API documentation UIpostman-to-openapi: Tool to convert Postman collections to OpenAPI
-
Clone the repository:
git clone https://github.com/srikanthlogic/google-play-api.git cd google-play-api -
Install dependencies:
npm install
-
Generate OpenAPI specification:
npm run generateoas
To start the development server locally:
npm startThe server will start on port 3000 (or the port specified in the PORT environment variable).
Create a .env file based on .env.sample to configure the application:
cp .env.sample .envAvailable environment variables:
| Variable | Default | Description |
|---|---|---|
PORT |
3000 |
Port on which the server runs |
COUNTRY_OF_QUERY |
IN |
Default country for Play Store queries |
LOGGING |
true |
Enable/disable HTTP request logging |
RATE_LIMIT_WINDOW_MS |
900000 |
Rate limit window in milliseconds |
RATE_LIMIT_MAX_REQUESTS |
100 |
Maximum requests per IP within the window |
RATE_LIMIT_SKIP_SUCCESSFUL_REQUESTS |
false |
Skip counting successful requests |
RATE_LIMIT_SKIP_FAILED_REQUESTS |
false |
Skip counting failed requests |
Once the server is running, you can access the interactive API documentation at:
The Google Play API server is configured with CORS middleware (cors package) to enable cross-origin requests from any origin (Access-Control-Allow-Origin: *).
- Methods: GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS
- Allowed Headers: Content-Type, Authorization, X-Requested-With, Accept
- Preflight Handling: OPTIONS requests return 204 with appropriate headers
- Security Headers:
X-Content-Type-Options: nosniffX-Frame-Options: DENYX-XSS-Protection: 1; mode=blockReferrer-Policy: no-referrerX-Powered-Byremoved
This setup balances openness for public API use with basic security measures.
The API server implements IP-based rate limiting to prevent abuse. Powered by express-rate-limit.
Customize via environment variables:
| Environment Variable | Default Value | Description |
|---|---|---|
RATE_LIMIT_WINDOW_MS |
900000 (15 minutes) |
Rate limit window in milliseconds |
RATE_LIMIT_MAX_REQUESTS |
100 |
Maximum number of requests allowed per IP within the window |
RATE_LIMIT_SKIP_SUCCESSFUL_REQUESTS |
false |
If true, skips counting successful (2xx, 3xx) responses |
RATE_LIMIT_SKIP_FAILED_REQUESTS |
false |
If true, skips counting failed (4xx, 5xx) responses |
- Applies to all API endpoints (
/api/*). - Uses in-memory store (Redis upgradable later).
- Includes standard rate limiting headers:
X-RateLimit-Limit,X-RateLimit-Remaining,X-RateLimit-Reset. - On limit exceed (429 Too Many Requests):
Retry-Afterheader with seconds until reset.- JSON error:
{ "error": { "message": "Too many requests..." } }
Fully compatible with the CORS configuration.
The project uses Newman for API testing, which runs collections of Postman tests.
To run the test suite:
npm testThis will execute two test collections:
GooglePlayAPI.postman_collection.json- Main API testsGPlayAPIUnitTests.postman_collection.json- Unit tests
Test results are displayed in the console and generated as HTML reports.
Test collections are located in the PostmanCollections/ directory:
GooglePlayAPI.postman_collection.json- Main API endpoint testsGPlayAPIUnitTests.postman_collection.json- Unit tests for specific functionalitypostman_environment.json- Environment variables for tests
The project uses ESLint with the semistandard configuration for code style and linting.
The project extends the semistandard style guide with specific rules:
- ES6+ syntax is enabled
- Node.js environment is assumed
- Mocha testing environment is supported
- Unused variables are flagged
To check code style:
npx eslint .To automatically fix some linting issues:
npx eslint . --fix- Fork the repository
- Create a feature branch:
git checkout -b feature-name - Make your changes and ensure they follow the code style guidelines
- Add tests for new functionality
- Run the test suite:
npm test - Commit your changes:
git commit -am 'Add some feature' - Push to the branch:
git push origin feature-name - Submit a pull request
The project includes a Dockerfile for containerized deployment:
# Build the image
docker build -t google-play-api .
# Run the container
docker run -p 3000:3000 google-play-apiThe Dockerfile uses a multi-stage build to optimize the final image size.
The project includes configuration files for Fly.io deployments:
fly.production.toml- Production environment configurationfly.staging.toml- Staging environment configuration
For production deployments:
- Set appropriate environment variables
- Consider using a reverse proxy (e.g., Nginx)
- Implement proper logging and monitoring
- Consider using Redis for rate limiting storage instead of in-memory storage
- Expose more endpoints helping towards archiving
- Support Global options
- Deta Support. #34
- Support Lists #36
- Support privacy friendly reviews extraction #40
- Google Play data is bound by terms of Google. We believe - the data in the Play Store ecosystem, belong to people (Users) and hence must be available to them in form that will allow them to make best use of.