Skip to content

MatheusIshiyama/sympla-homologation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

13 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Sympla Homologation API

A Node.js API service for integrating with Sympla's event management platform. This service provides event synchronization, order management, and automated data updates between your system and Sympla.

πŸš€ Features

  • Event Management: Sync and manage events from Sympla platform
  • Order Processing: Automatically update and sync orders with status tracking
  • Background Jobs: Automated order updates every 20 seconds for active events
  • Database Integration: PostgreSQL database with Prisma ORM
  • RESTful API: Clean REST endpoints for event and order operations
  • TypeScript: Full TypeScript support with strict typing

πŸ“‹ Prerequisites

  • Node.js (v18 or higher)
  • PostgreSQL database
  • pnpm (recommended) or npm

πŸ› οΈ Installation

  1. Clone the repository
git clone https://github.com/MatheusIshiyama/sympla-homologation.git
cd sympla-homologation
  1. Install dependencies
pnpm install
  1. Environment Setup Create a .env file in the root directory with the following variables:
# Database
DATABASE_URL="postgresql://username:password@localhost:5432/sympla_homologation"
DIRECT_URL="postgresql://username:password@localhost:5432/sympla_homologation"

# Server
PORT=3000
  1. Database Setup
# Generate Prisma client
pnpm prisma:generate

# Run database migrations
pnpm prisma:migrate

πŸš€ Usage

Development

# Start development server with hot reload
pnpm dev

Production

# Build the project
pnpm build

# Start production server
pnpm start

Database Management

# Open Prisma Studio (database GUI)
pnpm prisma:studio

# Generate Prisma client
pnpm prisma:generate

# Run migrations
pnpm prisma:migrate

πŸ“š API Documentation

Health Check

GET /health

Events

GET /sympla/events/:eventId

Returns event information by ID.

Example:

curl http://localhost:3000/sympla/events/1111111

πŸ—„οΈ Database Schema

The application uses PostgreSQL with the following main entities:

Events

  • Event management with integration details
  • Support for private/public events
  • Status tracking (active, published, cancelled)
  • Date range management (start_date, end_date)

Orders

  • Order processing and status tracking
  • Buyer information management
  • Transaction details and pricing
  • UTM tracking support

Participants

  • Attendee management for events
  • Order association
  • Contact information

Integrations

  • API configuration management
  • Credential storage
  • Service-specific settings

πŸ”„ Background Jobs

The application runs automated jobs every 20 seconds to:

  1. Fetch Active Events: Retrieve all active events from the database
  2. Update Orders: Sync new orders from Sympla API for each active event
  3. Status Validation: Filter orders with valid status ("A" for approved)
  4. Database Updates: Store new order data in the local database

πŸ—οΈ Project Structure

src/
β”œβ”€β”€ config/          # Environment and configuration
β”œβ”€β”€ controllers/     # API controllers
β”œβ”€β”€ database/        # Database connection
β”œβ”€β”€ jobs/           # Background job processing
β”œβ”€β”€ repositories/    # Data access layer
β”œβ”€β”€ routes/         # API route definitions
β”œβ”€β”€ services/       # Business logic
β”œβ”€β”€ types/          # TypeScript type definitions
└── utils/          # Utility functions

πŸ§ͺ Testing

Use the provided HTTP request files in the requests/ directory to test the API:

  • requests/events.http - Event endpoint testing
  • requests/health.http - Health check testing
  • requests/integrations/sympla.http - Integration testing

πŸ“ Scripts

Script Description
pnpm dev Start development server with hot reload
pnpm build Build the project for production
pnpm start Start production server
pnpm lint Run ESLint for code quality
pnpm prisma:generate Generate Prisma client
pnpm prisma:migrate Run database migrations
pnpm prisma:studio Open Prisma Studio GUI

πŸ”§ Configuration

Environment Variables

Variable Description Required
DATABASE_URL PostgreSQL connection string Yes
DIRECT_URL Direct database connection No
PORT Server port (default: 3000) No

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ‘¨β€πŸ’» Author

Matheus Ishiyama - matheus.ishiyama@outlook.com

πŸ†˜ Support

For support and questions, please contact the development team or create an issue in the repository.

About

Sympla Homologation is a Node.js API service that provides real-time synchronization with the Sympla event platform. Built with TypeScript, Express, and Prisma ORM, it automatically syncs order updates, manages participant validation, and tracks event data through scheduled background jobs.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors