### Docker Setup for Server Source: https://github.com/devclad-inc/devclad/blob/main/CONTRIBUTING.md Instructions for building and running the DevClad server using Docker. This involves building the Docker image and then starting the server using Docker Compose. ```docker docker-compose build docker-compose up ``` -------------------------------- ### Python Environment Setup with Poetry Source: https://github.com/devclad-inc/devclad/blob/main/CONTRIBUTING.md Steps to set up a Python development environment using Poetry. This includes installing Poetry, configuring it to use the project's virtual environment, installing dependencies, and exporting requirements. ```bash poetry config virtualenvs.in-project true poetry self update poetry env use python3.10.6 poetry install poetry export --without-hashes --format=requirements.txt > requirements.txt ``` -------------------------------- ### Gitpod Setup for DevClad Source: https://github.com/devclad-inc/devclad/blob/main/apps/server/readme.md Steps to set up the DevClad development environment using Gitpod, including Python version management, Poetry environment setup, and running the Django server. ```shell pyenv install 3.10.6 pyenv shell 3.10.6 poetry env use python3.10 poetry shell poetry install python manage.py migrate python manage.py runserver ``` -------------------------------- ### Install Yarn and Run Dev Server (Client) Source: https://github.com/devclad-inc/devclad/blob/main/CONTRIBUTING.md Installs Yarn globally and starts the development server for the DevClad client. The server runs on the default port 5173 and requires `vercel dev` to be executed for local serverless function execution. ```bash npm install --global yarn yarn install vercel dev ``` -------------------------------- ### Nixpacks + Docker Local Setup for DevClad Source: https://github.com/devclad-inc/devclad/blob/main/apps/server/readme.md Instructions for building and running the DevClad server locally using Nixpacks and Docker, emphasizing speed and ease of setup. ```shell brew install railwayapp/tap/nixpacks cd apps/server nixpacks build ./ --name devclad docker run -it -p 127.0.0.1:8000:8000/tcp devclad ``` -------------------------------- ### Run Development Server Source: https://github.com/devclad-inc/devclad/blob/main/apps/landing/README.md Commands to start the Next.js development server. These commands are essential for local development and testing. ```bash npm run dev # or yarn dev ``` -------------------------------- ### Styling and Formatting Conventions Source: https://github.com/devclad-inc/devclad/blob/main/README.md Details the styling guidelines for the project, including the use of tabs over spaces, Prettier for formatting, and the Airbnb Style Guide with ESLint. It also mentions the migration to Rome v10 and the use of `bun` for running linters and formatters. ```text Tabs not spaces. Tabs are 4 spaces. - (Exception: server code which uses Python with `black` formatting) - Use `prettier` for formatting. - Using [Airbnb Style Guide](https://github.com/airbnb/javascript) for ESLint with some modifications. - In the process of migrating to Romev10. Use `bun [command]` to run the linter/formatter. Prior to that, run `bun install` to install the dependencies. Why? `bun` is much faster even for a single commands like these. ``` -------------------------------- ### Cloudflare R2 Configuration Example Source: https://github.com/devclad-inc/devclad/blob/main/apps/userpics/README.md Shows how to retrieve Cloudflare R2 bucket configuration details from environment variables. These are necessary for deploying the serverless userpics service. ```go accountId := os.Getenv("ACCOUNT_ID") bucketName := os.Getenv("BUCKET_NAME") accessKeyId := os.Getenv("API_ACCESS_KEY") accessKeySecret := os.Getenv("API_SECRET_KEY") ``` -------------------------------- ### API Route Example Source: https://github.com/devclad-inc/devclad/blob/main/apps/landing/README.md An example of an API route in a Next.js application. This demonstrates how to create backend endpoints within the Next.js framework. ```typescript pages/api/hello.ts ``` -------------------------------- ### Pre-commit Hook Execution Source: https://github.com/devclad-inc/devclad/blob/main/CONTRIBUTING.md Commands to install and run pre-commit hooks. It's recommended to run `pre-commit run -a` after initial setup or when making changes to ensure code quality and consistency. ```bash pre-commit install pre-commit run -a ``` -------------------------------- ### Python Avatar Fetch Example Source: https://github.com/devclad-inc/devclad/blob/main/apps/userpics/README.md Demonstrates how to fetch a random avatar using the userpics API and save it as a PNG file. It handles the request, response streaming, and error checking. ```python import requests import uuid def random_avatar(): name = str(uuid.uuid4())[:8] with open(f"media/avatars/{name}.png", "wb+") as f: url = requests.get("https://userpics.devclad.com/api/getpic") response = requests.get(url.text, stream=True) if not response.ok: raise Exception("Could not get avatar") for block in response.iter_content(1024): if not block: break f.write(block) return f"avatars/{name}.png" ``` -------------------------------- ### Python Version Management with Pyenv Source: https://github.com/devclad-inc/devclad/blob/main/CONTRIBUTING.md Demonstrates how to manage Python versions using `pyenv`. It covers installing a specific Python version (e.g., 3.10.6) and setting it as the active version for the current shell session. ```bash brew install pyenv pyenv install 3.10.6 pyenv shell 3.10.6 ``` -------------------------------- ### Nixpack Deployment Configuration Source: https://github.com/devclad-inc/devclad/blob/main/README.md Provides information about Nixpack's role in deploying the server. It clarifies the presence of two Nixpack files: one at the root for deployment and another in `apps/server` for local builds, noting their near-identical nature. ```text Nixpack is used to deploy the server. _Why are there 2 of those files?_ The one at the root of the repo is used for deployment. The one in `apps/server` is used for local builds. They are almost identical. ``` -------------------------------- ### Userpics API Endpoints and Parameters Source: https://github.com/devclad-inc/devclad/blob/main/apps/userpics/README.md Documentation for the Serverless Userpics API, detailing available routes, query parameters, and avatar variants. This API allows fetching generated avatars. ```APIDOC API Endpoints: - /api/getpic/ - /api/avatar/ Query Parameters: - name: string (Your username. Defaults to 'Cactus Jack') - size: int (Size of the avatar. Default is 128) - variant: string (Variant of the avatar. Default is 'beam') - stream: bool (Stream the SVG instead of returning a URL. Default is False) Available Variants: - marble - pixel - beam - sunset - ring - bauhaus Note: The /api/avatar/ route with ?stream=True query outputs an SVG. ``` -------------------------------- ### GitHub OAuth Login Request Source: https://github.com/devclad-inc/devclad/blob/main/apps/web/readme.md This snippet demonstrates the client-side request to a serverless function to handle the GitHub OAuth code. It uses `axios` to send a POST request with the authorization code to the serverless endpoint. ```typescript const { pathname } = useLocation(); const code = queryParams.get('code'); const tokenUrl = `/api${pathname}`; const serverlessReq = async () => { await axios.post(tokenUrl, { code }); }; ``` -------------------------------- ### Absolute Imports Usage Source: https://github.com/devclad-inc/devclad/blob/main/README.md Explains the convention for using absolute imports within the project, specifically utilizing the '@' symbol for imports, with an exception for code within shared packages. ```text _Usage_: Use `@` for absolute imports. _Exception_: Code within shared packages. ``` -------------------------------- ### Robots.txt Directives Source: https://github.com/devclad-inc/devclad/blob/main/apps/web/public/robots.txt Defines rules for web crawlers. Includes User-agent to specify crawlers and Allow/Disallow to control access to paths. The '*' wildcard matches any user-agent. ```robots.txt User-agent: Googlebot Allow: / User-agent: Neevabot Allow: / User-agent: * Disallow: / ``` -------------------------------- ### CSS Styling for DevClad Source: https://github.com/devclad-inc/devclad/blob/main/apps/web/index.html This CSS code defines the styling for the main container of the DevClad application, centering its content and setting a dark background. ```css .nstext { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); background-color: #030405; height: 100%; width: 100%; } ``` -------------------------------- ### Password Reset Email Template Source: https://github.com/devclad-inc/devclad/blob/main/apps/server/devclad/templates/account/email/unknown_account_message.txt This Jinja2 template is used to send password reset notifications to users. It includes placeholders for user-specific information like email addresses and signup URLs. The template extends a base message template and utilizes internationalization (i18n) for multi-language support. ```html {% extends "account/email/base_message.txt" %} {% load i18n %} {% block content %}{% autoescape off %}{% blocktrans %}You are receiving this e-mail because you or someone else has requested a password for your user account. However, we do not have any record of a user with email {{ email }} in our database. This mail can be safely ignored if you did not request a password reset. If it was you, you can sign up for an account using the link below.{% endblocktrans %} {{ signup_url }}{% endautoescape %}{% endblock %} ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.