completed SMS gateway project
This commit is contained in:
137
QUICKSTART.md
Normal file
137
QUICKSTART.md
Normal file
@@ -0,0 +1,137 @@
|
||||
# Quick Start Guide - SMS Gateway API
|
||||
|
||||
This guide will help you get the SMS Gateway API up and running quickly.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
Ensure you have the following installed:
|
||||
- Ruby 3.4.7
|
||||
- PostgreSQL 14+
|
||||
- Redis 7+
|
||||
- Bundler 2.x
|
||||
|
||||
## Step-by-Step Setup
|
||||
|
||||
### 1. Install Dependencies
|
||||
|
||||
```bash
|
||||
bundle install
|
||||
```
|
||||
|
||||
### 2. Set Up Database
|
||||
|
||||
```bash
|
||||
# Create databases
|
||||
bin/rails db:create
|
||||
|
||||
# Run migrations
|
||||
bin/rails db:migrate
|
||||
|
||||
# Seed sample data (includes API keys and test gateways)
|
||||
bin/rails db:seed
|
||||
```
|
||||
|
||||
**⚠️ IMPORTANT**: After seeding, you'll see API keys printed. **Save these immediately** as they won't be shown again!
|
||||
|
||||
### 3. Start Redis
|
||||
|
||||
If Redis isn't running:
|
||||
|
||||
```bash
|
||||
redis-server
|
||||
```
|
||||
|
||||
### 4. Start Sidekiq (Background Jobs)
|
||||
|
||||
In a separate terminal:
|
||||
|
||||
```bash
|
||||
bundle exec sidekiq
|
||||
```
|
||||
|
||||
### 5. Start Rails Server
|
||||
|
||||
```bash
|
||||
bin/rails server
|
||||
```
|
||||
|
||||
The API will be available at `http://localhost:3000`
|
||||
|
||||
## Quick Test
|
||||
|
||||
### Test the Health Check
|
||||
|
||||
```bash
|
||||
curl http://localhost:3000/up
|
||||
```
|
||||
|
||||
Should return 200 OK.
|
||||
|
||||
### Send a Test SMS
|
||||
|
||||
Replace `YOUR_API_KEY` with the API key from the seed output:
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:3000/api/v1/sms/send \
|
||||
-H "Authorization: Bearer YOUR_API_KEY" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"to": "+1234567890",
|
||||
"message": "Test message from SMS Gateway API"
|
||||
}'
|
||||
```
|
||||
|
||||
### Check System Stats
|
||||
|
||||
```bash
|
||||
curl http://localhost:3000/api/v1/admin/stats \
|
||||
-H "Authorization: Bearer YOUR_API_KEY"
|
||||
```
|
||||
|
||||
## Next Steps
|
||||
|
||||
1. **Read the full API documentation** in `README.md`
|
||||
2. **Set up an Android gateway device** using the gateway API key from seeds
|
||||
3. **Configure webhooks** for real-time SMS notifications
|
||||
4. **Integrate OTP functionality** into your application
|
||||
|
||||
## Common Issues
|
||||
|
||||
### Redis Connection Error
|
||||
|
||||
Make sure Redis is running:
|
||||
```bash
|
||||
redis-cli ping
|
||||
```
|
||||
Should return `PONG`.
|
||||
|
||||
### Database Connection Error
|
||||
|
||||
Check your PostgreSQL is running and accessible:
|
||||
```bash
|
||||
psql -d my_smsa_pio_development
|
||||
```
|
||||
|
||||
### Sidekiq Not Processing Jobs
|
||||
|
||||
Ensure Sidekiq is running:
|
||||
```bash
|
||||
bundle exec sidekiq
|
||||
```
|
||||
|
||||
## Development Workflow
|
||||
|
||||
1. **Console**: `bin/rails console`
|
||||
2. **Routes**: `bin/rails routes | grep api`
|
||||
3. **Logs**: `tail -f log/development.log`
|
||||
4. **Sidekiq Web UI**: Add to routes and visit `/sidekiq`
|
||||
|
||||
## Getting Help
|
||||
|
||||
- Check `README.md` for complete API documentation
|
||||
- Check `CLAUDE.md` for development guidance
|
||||
- Review logs in `log/development.log` and `log/sidekiq.log`
|
||||
|
||||
---
|
||||
|
||||
Happy coding! 🚀
|
||||
Reference in New Issue
Block a user