Jump to content

Organizing related applications


NotionCommotion

Recommended Posts

I have two related websites which utilize the same database:

  1. Main website for public use.
  2. Admin website for administration purposes.

Currently, I have both located in /var/www/combined-app which is a single git repository and contains the following:

/var/www/combined-app/
    public/
    public-admin/
    src/
        main/
        admin/
    vendor/
    composer.json
    bootstrap.php

Alternatively, I could have done the following:

/var/www/combined-app/
    main/
        public/
        src/
        vendor/
        composer.json
        bootstrap.php
    admin/
        public/
        src/
        vendor/
        composer.json
        bootstrap.php

Or maybe something else all together?

Is one approach typically better than the other?   If so, please provide reasons why.  If my second example, would you recommend separate git repositories for main and admin?

Thanks

Link to comment
Share on other sites

If you're developing them as essentially separate sites I'd probably give them separate repositories as well.  I'd also use separate domains such as www.example.com and admin.example.com, which would then end up being separate folders on disk such as /var/www/www.example.com/ and /var/www/admin.example.com/

Whatever works best for you and makes sense is probably fine though.

I'm currently working on an API for an existing site.  Like you the API and the site share the same database but are separate things more or less.  The API has it's own git repository and is stored on a separate folder on the server.  Since I don't control to domain it'll end up just being a sub-folder of the current site via an Alias /api /var/www/example-api in the server configuration.

 

Link to comment
Share on other sites

Thanks kicken,

I currently use separate domains but will also go with separate repositories as you recommend.

I was original thinking the Domain (I've been going down the ORM journey and I am currently thinking the domain consists of the Entities and Repositories) would need to exist under both the main and admin apps, but now am thinking it should exist independent of each and exist on its own as it reflects the business logic and database which is used by both sites.

On a related note, I was reading this post which promotes organizing by "module"...

src/
    BasketModule/
        Basket.php
        BasketService.php
        BasketRepository.php
        ORM/
            Basket.orm.yml
    ProductModule/
        Product.php
        ProductService.php
        ProductRepository.php
        ORM/
            Product.orm.yml

instead of the "classical" layout...

src/
    Entity/
        Product.php
        Basket.php
    Service/
        ProductService.php
        BasketService.php
    Repository/
        ProductRepository.php
        BasketRepository.php
    Resources/
        ORM/
            Product.orm.yml
            Basket.orm.yml

At first I thought it was a good idea, but now am thinking the Repository script can possibly span multiple entities and I will probably keep with a modified classical layout.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.