Backend API server for the NFTeams mobile application, built with Express.js, TypeScript, and Turso database.
- Clone the repository:
git clone [repository-url]
cd nfteams-mobile-api- Install dependencies:
npm install- Create a .env file in the root directory:
PORT=3000
JWT_SECRET=your_jwt_secret
NEXT_PUBLIC_URL_FOUR=your_turso_url
NEXT_PUBLIC_TOKEN_FOUR=your_turso_token
NEXT_PUBLIC_API=your_alchemy_api_key- Start the development server:
npm run dev- POST
/api/auth/login- User login - POST
/api/auth/register- User registration
- GET
/api/teams/:wallet- Get teams owned by wallet - GET
/api/teams/score/:teamId- Get team score
- POST
/api/competition/enter- Enter team in competition - POST
/api/competition/update-scores- Update competition scores
PORT: Server port (default: 3000)JWT_SECRET: Secret key for JWT token generationNEXT_PUBLIC_URL_FOUR: Turso database URLNEXT_PUBLIC_TOKEN_FOUR: Turso database authentication tokenNEXT_PUBLIC_API: Alchemy API key for NFT verification
# Run in development mode
npm run dev
# Build for production
npm run build
# Run in production mode
npm startPOST /api/auth/login
Content-Type: application/json
{
"wallet_address": "0x..."
}Response:
{
"token": "jwt_token_here",
"wallet_address": "0x..."
}GET /api/teams/0x...
Authorization: Bearer jwt_token_hereResponse:
{
"teams": [
{
"team_id": 537,
"name": "Team Name",
"image": "image_url"
}
]
}POST /api/competition/enter
Authorization: Bearer jwt_token_here
Content-Type: application/json
{
"teamId": 537
}Response:
{
"text": "Entry pending for Team 537 in Competition 1",
"type": "text"
}The API uses standard HTTP status codes:
- 200: Success
- 400: Bad Request
- 401: Unauthorized
- 403: Forbidden
- 404: Not Found
- 500: Server Error
Error responses follow this format:
{
"error": "Error message here",
"details": "Additional error details (if any)"
}- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Please make sure to update tests as appropriate and follow the existing code style.
[License Type] - see LICENSE file for details