Skip to content

cardanoapi/cardanoapi.io

Repository files navigation

Cardano API Projects Directory

A list of Cardano API Projects

Tech Stack

Frontend

  • Next.js with TypeScript
  • Tailwind CSS for styling
  • Jest for testing

Backend

  • Rust
  • Axum for REST API
  • Postgres for database
  • SQLx for database operations
  • Docker for containerization

Prerequisites

  • Node.js (v18 or higher)
  • Rust (latest stable version)
  • Docker and Docker Compose
  • PostgreSQL (if running without Docker)

Getting Started

Clone the repository

git clone https://github.com/cardanoapi/cardanoapi.io.git
cd cardanoapi.io

Backend Development

  1. Navigate to the backend directory:
cd backend/api
  1. Setup .env file as:
//backend/api/.env
POSTGRES_HOST=127.0.0.1
POSTGRES_PORT=6500
POSTGRES_USER= <YOUR_POSTGRES_USERNAME>
POSTGRES_PASSWORD=<YOUR_POSTGRES_PASSWORD>
POSTGRES_DB=rust_sqlx

DATABASE_URL=postgresql://<YOUR_POSTGRES_USERNAME>:<YOUR_POSTGRES_PASSWORD>@localhost:6500/rust_sqlx?schema=public

[email protected]
PGADMIN_DEFAULT_PASSWORD=<YOUR_PGADMIN_PASSWORD>

  1. Install dependencies:
cargo build
  1. Start the Postgres Database and PG Admin
docker compose -f docker-compose.yml up
  1. Run the Rust server:
cargo run

Test if the server is working at http://localhost:8000/test

Frontend Development

  1. Install dependencies:
npm install
  1. Setup .env file as:
//.env
POSTGRES_HOST=127.0.0.1
POSTGRES_PORT=6500
POSTGRES_USER= <YOUR_POSTGRES_USERNAME>
POSTGRES_PASSWORD=<YOUR_POSTGRES_PASSWORD>
POSTGRES_DB=rust_sqlx

DATABASE_URL=postgresql://<YOUR_POSTGRES_USERNAME>:<YOUR_POSTGRES_PASSWORD>@localhost:6500/rust_sqlx

[email protected]
PGADMIN_DEFAULT_PASSWORD=<YOUR_PGADMIN_PASSWORD>


# Frontend Configuration
API_URL=http://localhost:8000
NODE_ENV=development
  1. Run the development server:
npm run dev

The frontend will be available at http://localhost:3000

Using Docker

Development Environment

docker compose -f docker-compose-dev.yml up

Production Environment

docker compose -f docker-compose-prod.yml up

Database Migrations

The project uses SQL migrations located in backend/api/migrations/. To run migrations:

  1. Ensure you're in the backend/api directory
  2. Run:
sqlx migrate run

Testing

Frontend Tests

npm test

Project Structure


├── src/
│   └── app/
│       ├── globals.css
│       ├── layout.tsx
        |__ projects
            |_[id]
              |__page.tsx //Project Detail Page
│       ├── page.tsx      //Home Page (/)
│       ├── Component/
│       │   ├── Card.tsx
│       │   ├── Pagination.tsx
│       │   └── SimilarProjects.tsx

└── public/          # Static assets
└── backend (Rust)
    └── api/
        ├── migrations/   # Database migrations
        └── src/         # Rust source code

Contributing

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published