Giter Club home page Giter Club logo

anonymous-comrades's Introduction

Anonymous Comrades

Anonymous Comrades is a Laravel-based API-secured anonymous chat platform developed for the Treblle API Security Hackathon. It aims to explore innovative techniques for ensuring privacy, anonymity, and secure communication in an anonymous chat application. Let's revolutionize the world of secure and confidential conversations together using Treblle ๐Ÿฅณ!

Technology Stack

The Anonymous Comrades project utilizes the following technologies:

  • Laravel: A powerful PHP framework for web application development.
  • MySQL: A popular open-source relational database management system.
  • Treblle: A comprehensive API monitoring and security platform.
Screenshot 2023-07-06 at 12 30 59

Getting Started

To spin up the Anonymous Comrades application locally, follow these steps:

  1. Clone the repository:

    git clone https://github.com/ttebify/anonymous-comrades.git
  2. Navigate to the project directory:

    cd anonymous-comrades
  3. Install the dependencies using Composer:

    composer install
  4. Create a copy of the .env.example file and rename it to .env. Update the necessary configuration values, such as the database connection details and Treblle API credentials.

  5. Generate a new application key:

    php artisan key:generate
  6. Run the database migrations and seed the database:

    php artisan migrate:fresh --seed
  7. Start the development server:

    php artisan serve
  8. Open your web browser and visit http://localhost:8000 to access the Anonymous Comrades application.

How to Run the Project with SSL Enabled

To run the project on your local development server with SSL enabled, you can utilize ngrok as a proxy server. Ngrok masks the localhost URL and provides a usable URL for your application.

Follow this steps:

  1. Install ngrok: Go to https://ngrok.com/download and download the ngrok executable suitable for your operating system. Extract the ngrok executable to a folder on your computer.
  2. Start your local development server: Open a terminal window and navigate to the root directory of your Laravel project. Initiate your local development server by running php artisan serve to start the server.
  3. Start ngrok: Open another terminal window and navigate to the folder where you extracted the ngrok executable. Start ngrok by running the following command: ./ngrok http <port>, where <port> is the port number your local development server is running on. For example, if you ran php artisan serve, the default port is 8000, so the command would be ./ngrok http 8000. Ngrok will generate a unique URL for your local development server, which you can access from anywhere.
  4. Use the ngrok URL to access your project: Once ngrok is running, you'll see a screen showing the ngrok URL and some information about the HTTP and HTTPS tunnels. Copy the HTTPS ngrok URL (or the HTTP URL if you don't need HTTPS) and paste it into your own Postman environment variable.

Ensure that you adjust the instructions according to your specific setup and requirements.

Meet the Team

A table of avatars from the project's contributors

References:

Design and Requirements: Link to Design and Requirements Document

Postman Collection: Link to Anonymous Comrades Postman Collection

License

This project is licensed under the MIT License. Feel free to use and modify the codebase as per the terms of the license.

Acknowledgments

We would like to express our gratitude to the Treblle team for organizing the API Security Hackathon and providing the opportunity to build innovative and secure APIs. Thank you for your support!

anonymous-comrades's People

Contributors

ionikdev avatar ttebify avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

anonymous-comrades's Issues

[FEATURE]: Authentication and User Endpoints Implementation (Due 5th July 2023)

Task Description:

The objective of this issue is to implement the authentication and user endpoints for our application. The endpoints will allow users to perform various actions related to authentication and user management. The specific endpoints to be created are as follows:

Authentication Endpoints:

  • POST /api/login: User login
  • POST /api/register: User registration
  • POST /api/reset-password: Request password reset
  • POST /api/reset-password/{token}: Reset password with token

User Endpoints:

  • GET /api/users/me: Retrieve current user's profile
  • PATCH /api/users/me: Update current user's profile
  • GET /api/users/{uuid}: Retrieve user profile by ID

Acceptance Criteria:

  • The authentication endpoints should enable users to log in, register, and reset their password.
  • The user endpoints should allow users to retrieve their own profile, update their profile, and retrieve other user profiles by ID.
  • The endpoints should be implemented according to the project's API design guidelines.
  • Proper authentication and authorisation checks should be implemented to ensure security and access control.

Implementation Guidelines:

  • Create the necessary API routes and controller methods for each endpoint.
  • Implement the logic for user authentication, registration, password reset, and profile management.
  • Ensure that the authentication endpoints validate user input and handle various error scenarios appropriately.
  • Implement appropriate data validation and sanitisation measures to protect against common security vulnerabilities.
  • Write unit tests for the implemented endpoints to ensure their correctness and robustness.
  • Update the project documentation with details of the newly created endpoints.
  • Perform thorough testing and debugging to ensure the endpoints function as expected.

[IMPROVE]: Write Tests for Postman Requests

Task Description:

This issue focuses on writing tests for all the Postman requests in the project. Writing tests will help ensure the reliability and correctness of the API endpoints, allowing for better validation of their functionality. The specific tasks to be performed are as follows:

Acceptance Criteria:

  • Tests are written for all Postman requests in the project.
  • Each test covers various scenarios and edge cases for the respective request.
  • The tests execute successfully and produce the expected results.
  • The Postman collection or workspace is updated with the newly written tests.

[FEATURE]: Implement Public Chats Endpoints

Task Description:

The goal of this issue is to create and implement the necessary endpoints for managing public chats. Public chats allow users to engage in conversations visible to all users of the application. The following endpoints need to be implemented:

Public Chat Endpoints:

  • GET /api/public-chats: Retrieve all public chats
  • POST /api/public-chats: Create a new public chat
  • DELETE /api/public-chats/{uuid}: Delete a public chat

Acceptance Criteria:

  • The GET endpoint should retrieve all public chats stored in the system.
  • The POST endpoint should create a new public chat with the provided data.
  • The DELETE endpoint should delete a public chat based on the specified UUID.
  • All endpoints should have appropriate request handling and error responses.

Implementation Guidelines:

  1. Create the necessary routes and corresponding controller methods for the public chat endpoints.
  2. Implement the logic to retrieve all public chats in the GET endpoint.
  3. Implement the logic to create a new public chat in the POST endpoint.
  4. Implement the logic to delete a public chat in the DELETE endpoint.
  5. Ensure proper request validation and error handling for all endpoints.
  6. Test each endpoint locally to verify their functionality.
  7. Update the API documentation to include details about the newly added public chat endpoints.

[FEATURE]: Implement Message Endpoints

Task Description:

The objective of this issue is to create and implement the necessary endpoints for managing messages within chat rooms. Messages are the main form of communication in the application, and these endpoints will enable users to retrieve, send, and delete messages within specific chat rooms. The following endpoints need to be implemented:

Message Endpoints:

  • GET /api/chat-rooms/{roomId}/messages: Retrieve messages in a chat room
  • POST /api/chat-rooms/{roomId}/messages: Send a message to a chat room
  • DELETE /api/chat-rooms/{roomId}/messages/{messageId}: Delete a message in a chat room

Acceptance Criteria:

  • The GET endpoint should retrieve all messages within the specified chat room.
  • The POST endpoint should allow users to send a new message to the specified chat room.
  • The DELETE endpoint should delete the specified message within the specified chat room.
  • All endpoints should have appropriate request handling and error responses.

Implementation Guidelines:

  1. Create the necessary routes and corresponding controller methods for the message endpoints.
  2. Implement the logic to retrieve messages within a chat room in the GET endpoint.
  3. Implement the logic to send a new message to a chat room in the POST endpoint.
  4. Implement the logic to delete a message within a chat room in the DELETE endpoint.
  5. Ensure proper request validation and error handling for all endpoints.
  6. Test each endpoint locally to verify their functionality.
  7. Update the API documentation to include details about the newly added message endpoints.

[FEATURE]: Implement Account Configuration Endpoints

Task Description:

The objective of this issue is to create the necessary endpoints for user account configuration. These endpoints will allow users to retrieve and update their account settings. The specific endpoints to be implemented are as follows:

Account Configuration Endpoints:

  • GET /api/users/me/settings: Retrieve user account settings
  • POST /api/users/me/settings: Update user account settings

Acceptance Criteria:

  • The GET endpoint should return the current user's account settings.
  • The POST endpoint should allow users to update their account settings.
  • The endpoints should be correctly implemented and integrated into the project.
  • Postman collections and documentation should be updated accordingly.

Implementation Guidelines:

  1. Create the API routes and controller methods for the account configuration endpoints.
  2. Implement the logic to retrieve and update the user's account settings.
  3. Ensure that appropriate authentication and authorization checks are in place to protect user data.
  4. Test the endpoints locally to verify their functionality.
  5. Create or update the corresponding requests in the Postman collection to reflect the newly implemented endpoints.
  6. Update the API documentation, if necessary, to include details about the account configuration endpoints.

[FEATURE]: Implement Chat Room Endpoints

Task Description:

The purpose of this issue is to create and implement the necessary endpoints for managing chat rooms within the application. Chat rooms provide a platform for users to engage in conversations with other users. The following endpoints need to be implemented:

Chat Room Endpoints:

  • GET /api/chat-rooms: Retrieve all chat rooms
  • POST /api/chat-rooms: Create a new chat room
  • GET /api/chat-rooms/{uuid}: Retrieve chat room by ID
  • DELETE /api/chat-rooms/{uuid}: Delete chat room by ID

Acceptance Criteria:

  • The GET endpoint should retrieve all chat rooms stored in the system.
  • The POST endpoint should create a new chat room with the provided data.
  • The GET endpoint with a specific UUID should retrieve the chat room based on the specified ID.
  • The DELETE endpoint with a specific UUID should delete the chat room based on the specified ID.
  • All endpoints should have appropriate request handling and error responses.

Implementation Guidelines:

  1. Create the necessary routes and corresponding controller methods for the chat room endpoints.
  2. Implement the logic to retrieve all chat rooms in the GET endpoint.
  3. Implement the logic to create a new chat room in the POST endpoint.
  4. Implement the logic to retrieve a chat room by its UUID in the GET endpoint.
  5. Implement the logic to delete a chat room by its UUID in the DELETE endpoint.
  6. Ensure proper request validation and error handling for all endpoints.
  7. Test each endpoint locally to verify their functionality.
  8. Update the API documentation to include details about the newly added chat room endpoints.

[FEATURE]: Implement Image File Upload Endpoint

Task Description:

The purpose of this issue is to create an endpoint for uploading image files specifically for use in chats. The endpoint will allow users to upload image files and handle them appropriately. The specific endpoint to be implemented is as follows:

File Upload Endpoint:

POST /api/upload/image: Upload an image file

Acceptance Criteria:

  • The POST endpoint should enable users to upload image files.
  • Only image files should be accepted for upload, with appropriate validation checks.
  • The uploaded image files should be processed and stored correctly.
  • The endpoint should be correctly implemented and integrated into the project.

Implementation Guidelines:

  1. Create the API route and corresponding controller method for the image file upload endpoint.
  2. Implement the logic to handle image file uploads.
  3. Validate the uploaded files to ensure they are valid image files (e.g., check file extension, MIME type).
  4. Process and store the uploaded image files in the appropriate location or storage system.
  5. Test the endpoint locally to verify its functionality, including both successful and error scenarios.
  6. Update the API documentation, if necessary, to include details about the image file upload endpoint.

[FEATURE]: Application Models and Seeds Creation

Task Description:

The goal of this issue is to create various application models and corresponding seeds for our project. The models and seeds will be divided between the two team members as follows:

@ionikdev tasks:

  • Create User model and seeds
  • Create ChatRoom model and seeds
  • Create Message model and seeds

@ttebify tasks:

  • Create PublicChat model and seeds
  • Create UserSettings model and seeds
  • Setup project GitHub profile

Additional Information:

  • The models should be designed according to the project requirements and specifications.
  • The seeds should populate the initial data for each model, ensuring that the application can be properly tested and demonstrated.
    The GitHub profile setup involves configuring the pull request template protecting the main branch etc.

Acceptance Criteria:

  1. Each model should be created with the necessary attributes and associations.
  2. Seeds should be generated to populate the models with realistic test data.

References:

  1. Design and Requirements: Link to Design and Requirements Document

[FEATURE]: Implement Dashboard Endpoint

Task Description:

This issue aims to create the necessary endpoint to retrieve dashboard information. The endpoint will provide various details, including the current user's profile, total message count, total room count, and public chats with counts. The specific endpoint to be implemented is as follows:

Dashboard Endpoint:

  • GET /api/dashboard: Retrieve dashboard information

Example Response:

{
  "userProfile": {
    "name": "John Doe",
    "email": "[email protected]",
    "avatar": "https://example.com/avatar.png"
  },
  "messageCount": 150,
  "chatRoomCount": 10,
  "publicChats": [
    {
      "id": "01EJCJKH0ZJFJS7CJ15KHF6MYD",
      "content": "This is a public chat message.",
      "hidden": false,
      "created_by": "01EJCJKH0ZJFJS7CJ15KHF6MYD",
      "created_at": "2023-07-04T10:30:00Z",
      "updated_at": "2023-07-04T10:30:00Z"
    },
    {
      "id": "01EJCJKH0ZJFJS7CJ15KHF6MYE",
      "content": "Another public chat message.",
      "hidden": false,
      "created_by": "01EJCJKH0ZJFJS7CJ15KHF6MYE",
      "created_at": "2023-07-04T11:15:00Z",
      "updated_at": "2023-07-04T11:15:00Z"
    },
  ]
}

Acceptance Criteria:

  • The GET endpoint should successfully retrieve dashboard information.
  • The response should include the current user's profile, total message count, total room count, and public chats with counts.
  • The endpoint should be correctly implemented and integrated into the project.
  • An example response in JSON format should be provided.

Implementation Guidelines:

  1. Create the API route and corresponding controller method for the dashboard endpoint.
  2. Implement the logic to gather the required information, such as the current user's profile, total message count, total room count, and public chats with counts.
  3. Test the endpoint locally to ensure the correct retrieval of dashboard information.
  4. Update the API documentation, if necessary, to include details about the dashboard endpoint and the example response.

[FEATURE]: Integrate Treblle API and Add Treblle Tools

Task Description:

The objective of this issue is to integrate the Treblle API and add all necessary Treblle tools as specified in the requirements for the hackathon. Treblle provides a suite of tools for monitoring, logging, and error tracking, which will enhance the functionality and stability of the application. The specific tasks to be performed are as follows:

  1. Review the Treblle API documentation and familiarize yourself with the available tools and features.
  2. Integrate the Treblle API into the application, following the provided integration instructions.
  3. Implement the required Treblle tools as specified in the hackathon requirements. This may include tools for monitoring, logging, error tracking, or any other relevant functionality.
  4. Test the integration and ensure that the Treblle tools are functioning correctly within the application.
  5. Document the integration process, including any configuration settings or considerations.
  6. Update the project documentation to include information about the integration and the added Treblle tools.

Acceptance Criteria:

  • The Treblle API is successfully integrated into the application.
  • All required Treblle tools specified in the hackathon requirements are implemented.
  • The integrated Treblle tools are functional and provide the expected monitoring, logging, and error tracking capabilities.
  • Documentation is updated to include information about the integration process and the added Treblle tools.

[FEATURE]: Unit Test Setup and Postman Integration (Due 5th July 2023)

Task Description:

The purpose of this issue is to set up unit testing for the project and integrate Postman for API testing. Additionally, the README file needs to be updated to reflect the changes made. The specific tasks involved are as follows:

  • Set up unit testing framework and configuration.
  • Write the first test case for the project.
  • Create a Postman workspace for the team and add all members to the project.
  • Update the README file, specifically on line 8, to reflect the changes in how to run the project. The instructions should now include using Postman and provide a link to the public workspace.

Acceptance Criteria:

  • The unit testing framework should be correctly set up and configured.
  • At least one test case should be written, covering a critical component or functionality of the project.
  • The Postman workspace should be created, and all team members should be added to the project.
  • The README file should be updated to include instructions on using Postman and a link to the public workspace.

Implementation Guidelines:

  • Choose a unit testing framework suitable for the project and set it up within the project.
  • Configure the necessary test runner and test libraries to enable running unit tests.
  • Write the first test case, focusing on a critical component or functionality of the project. Ensure the test provides comprehensive coverage and validates the expected behaviour.
  • Run the test suite to verify that the test case executes successfully.
  • Create a Postman workspace for the team and invite all members to join.
  • Set up the necessary API collections and environments in the Postman workspace.
  • Grant appropriate permissions to team members within the Postman workspace, allowing them to collaborate and contribute to the project's API testing.
  • Update the README file, specifically on line 8, to reflect the changes in how to run the project. Replace the previous instructions with new instructions for using Postman and provide a link to the public workspace.

[DOCS]: Write Documentation for Postman Endpoints

Task Description:

The purpose of this issue is to write documentation for all the endpoints in Postman that currently lack documentation. This will ensure that all endpoints have clear and comprehensive descriptions, making it easier for team members and users to understand and utilise the API. The specific tasks involved are as follows:

  • Identify the endpoints in Postman that do not yet have documentation.
  • Write detailed descriptions and explanations for each of the undocumented endpoints.
  • Include information about the expected request parameters, response formats, and any specific considerations or requirements.
  • Update the Postman collection or workspace with the newly written documentation.

Acceptance Criteria:

  • All endpoints in Postman should have documentation.
  • Each endpoint should have a clear and comprehensive description, including request parameters and response details.
  • The Postman collection or workspace should be updated with the newly written documentation.

Implementation Guidelines:

  1. Review the existing endpoints in the Postman collection or workspace.
  2. Identify the endpoints that currently lack documentation.
  3. For each undocumented endpoint, write a detailed description that explains the purpose and functionality of the endpoint.
  4. Include information about the expected request parameters, their formats, and any validation rules.
  5. Describe the response format and any relevant data or metadata included in the response.
  6. If necessary, provide additional information or instructions for using the endpoint correctly.
  7. Update the Postman collection or workspace, adding the documentation to the appropriate endpoint(s).
  8. Test the documentation by making sample requests and verifying that the responses align with the documented expectations.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.