PyE Times is a news website built for the PyE community, developed in Rust using the Axum web framework and PostgreSQL database.
Before running PyE Times, make sure you have the following installed:
If you want to run this application locally, you will need:
- Rust (at least 1.86.0)
- PostgreSQL (version 17 or higher)
if you want to run this application in a container, you will need:
- Docker (optional, for containerized deployment)
Create a .env file in the root directory with the following variables:
# Database Configuration
DATABASE_URL=postgres://username:password@localhost:5432/pyetimes_db
# Discord Bot Configuration (optional)
DISCORD_BOT_URL=discord_bot_url
DISCORD_BOT_TOKEN=your-discord-bot-tokenthe discord bot repository is PyETimes DsBot
DATABASE_URL: PostgreSQL connection string (required)DISCORD_BOT_URL: Discord webhook URL for bot integration (optional)DISCORD_BOT_TOKEN: Discord bot token for authentication (optional)
-
Clone the repository:
git clone https://github.com/darilrt/pyetimes cd pyetimes -
Set up the database:
# Create a PostgreSQL database createdb pyetimes_db # Or using psql psql -c "CREATE DATABASE pyetimes_db;"
-
Configure environment variables:
cp .env.example .env # Edit .env with your database credentials and Discord settings -
Install dependencies and build:
cargo build
-
Run the application:
cargo run
The server will start on http://localhost:3000
To reload the application during development, you need install cargo-watch and use:
cargo watch -x run-
Build optimized release:
cargo build --release
-
Run the production binary:
./target/release/pyetimes
-
Build the Docker image:
docker build -t pyetimes . -
Run with external database:
docker run -p 3000:3000 \ -e DATABASE_URL=postgres://user:password@host:5432/pyetimes_db \ pyetimes
src/
├── api/ # API endpoints and routes
├── middleware/ # Custom middleware (caching, etc.)
├── models/ # Data models and structures
├── pages/ # Web page handlers
├── repo/ # Database repository layer
├── utils/ # Utility functions (auth, markdown, discord)
├── web/ # Web components and templates
├── db.rs # Database connection and setup
├── error.rs # Error handling
├── main.rs # Application entry point
└── state.rs # Application state management
web/
├── components/ # Reusable UI components (.mk files)
├── pages/ # Page templates (.mk files)
└── static/ # Static assets (CSS, JS, images)
The application uses SQLx for database operations. Make sure your PostgreSQL database is running and accessible with the credentials specified in your DATABASE_URL.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- axum: Modern web framework for Rust
- tokio: Asynchronous runtime
- sqlx: Async SQL toolkit with PostgreSQL support
- serde: Serialization/deserialization framework
- tower: Modular service library
- magik: Custom framework components Magik Repository
- chrono: Date and time library
- bcrypt: Password hashing
- pulldown-cmark: Markdown parser
See Cargo.toml for the complete list of dependencies and their versions.
This project is licensed under the terms specified in LICENSE.txt.
For questions or issues, please open an issue on the repository or contact the PyE community.